Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 3,856 through 3,870 (of 4,839 total)
  • Author
    Posts
  • in reply to: Image Advanced field "Force delete" option doesn't work #24110
    Long NguyenLong Nguyen
    Moderator

    Hi,

    I also use the MB Builder on the screen record. The documentation also notes about this setting:

    force_delete Whether or not delete the images from Media Library when deleting them from post meta. true or false (default).

    Delete the image from the list of the field which is created by Meta Box - post meta, not delete the image when deleting the post.

    in reply to: front end submission dashboard with custom post type #24109
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please share the admin site account via this contact form https://metabox.io/contact/. I will check the Frontend Dashboard on your site.

    in reply to: front end submission dashboard with custom post type #24104
    Long NguyenLong Nguyen
    Moderator

    Hi Radoslaw,

    Please share some screenshots (full screen) when editing the page (frontend submit and frontend dashboard) and shortcodes that you are using. I've tested the frontend dashboard with two post types but not see any issue.

    in reply to: Image Advanced field "Force delete" option doesn't work #24101
    Long NguyenLong Nguyen
    Moderator

    Hi,

    The option 'force_delete' => true is to delete the media file when removing it from the post meta (list images of image_advanced field). See my screen record for more information https://share.getcloudapp.com/v1u4Z8BD.

    in reply to: Show term meta on custom post type #24096
    Long NguyenLong Nguyen
    Moderator

    Hi,

    At first, please follow this documentation to know how to use AJAX in WordPress https://codex.wordpress.org/AJAX_in_Plugins, then you can use this sample code to show the term meta on selecting the field taxonomy.

    add_action( 'admin_footer', function() {
        ?>
        <script>
            jQuery(document).ready(function($) {
                $('.rwmb-field').on('change', function() {
                    var that = $(this);
                    // Get the term ID on select
                    var term_id = that.find('select[name=post_meta_taxonomy').val();
    
                    // Create a div to show the response
                    that.append('<div id="meta-taxonomy-response"></div>');
    
                    var data = {
                        'action': 'my_action',
                        'term_id': term_id,
                    };
                
                    jQuery.post(ajaxurl, data, function(response) {
                        $('#meta-taxonomy-response').html(response);
                    });
                })
            });
        </script>
        <?php
    } );
    
    add_action( 'wp_ajax_my_action', 'my_action' );
    
    function my_action() {
        $term_id = $_POST['term_id'];
    
        if( isset( $term_id ) ) {
            $term_meta = rwmb_meta( 'category_meta_text', array( 'object_type' => 'term' ), $term_id );
            echo '<h4 style="color: red">Category Meta Text: ' . $term_meta. '</h4>';
        } else {
            echo "Not found";
        }
    
        wp_die(); // this is required to terminate immediately and return a proper response
    }

    Screen record https://share.getcloudapp.com/5zudxE49.

    in reply to: Show term meta on custom post type #24093
    Long NguyenLong Nguyen
    Moderator

    You can also use the AJAX in WordPress to get the term meta right after select the term. Example in this artilce.

    in reply to: Show term meta on custom post type #24092
    Long NguyenLong Nguyen
    Moderator

    Hi,

    I think you can use the filter rwmb_{$field_id}_end_html to use the field value and add some HTML code after the field appearance. For simple example, I have the custom field post_meta_taxonomy type taxonomy for the post and a custom field category_meta_text for the taxonomy Category. The code below would help you to show the term meta base on the term ID selected.

    add_filter( 'rwmb_post_meta_taxonomy_end_html', function( $end, $field, $meta ) {
        $term_meta = rwmb_meta( 'category_meta_text', array( 'object_type' => 'term' ), $meta );
    
        if( !empty( $term_meta ) ) {
            $end .= '<h4 style="color: red">Category Meta Text: ' . $term_meta. '</h4>';
        }
        
        return $end;
    }, 10, 3 );

    See a short screen record https://share.getcloudapp.com/YEuQxzny.

    in reply to: Get the post id as value #24091
    Long NguyenLong Nguyen
    Moderator

    Hi,

    If you are using the extension MB Frontend Submission to submit a post from the frontend, you can use the action hook rwmb_frontend_after_process to update the current post ID to the field value.

    The code would be:

    add_action( 'rwmb_frontend_after_process', function( $config, $post_id ) {
        if ( 'confirmation-lecture' === $config['id'] ) {
            update_post_meta( $post_id, 'testtest', get_queried_object_id() );
        }
    }, 10, 2 );

    $post_id is the ID of the post that will be created.
    get_queried_object_id() is the function which returns the current post ID (the post that shows the form submit).

    in reply to: Date before 1970: timestamp is stored as positive #24090
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Thank you for your reporting.

    The sanitization is used for the regular cases, for a specific case, you can bypass the sanitization by using the setting 'sanitize_callback' => 'none'. Get more details in the documentation https://docs.metabox.io/sanitization/#bypass-the-sanitization.

    in reply to: Get the post id as value #24086
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please see my screen record https://share.getcloudapp.com/DOuopnDR. The code works as well on my local site. If it still does not work, please share the admin site account via this contact form, I will check it out.

    in reply to: Get the post id as value #24077
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Have you tried the code that I post above?

    function confirmation_lecture_register_meta_boxes( $meta_boxes ) {
        $prefix = '';
        // Get the $post_id here
        $post_id = null;
        if ( isset( $_GET['post'] ) ) {
            $post_id = intval( $_GET['post'] );
        } elseif ( isset( $_POST['post_ID'] ) ) {
            $post_id = intval( $_POST['post_ID'] );
        }
    
        $meta_boxes[] = [
            'title'      => esc_html__( 'Confirmation de lecture', 'text-domain' ),
            'id'         => 'confirmation-lecture',
            'fields'     => [
                [
                    'id'   => $prefix . 'testtest',
                    'type' => 'text',
                    'attributes' => array(
                        'value' =>  $post_id, // Here is the value who's not working
                    )
                ]
            ],
        ];
    
        return $meta_boxes;
    }
    in reply to: Get the post id as value #24073
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Get and echo the post ID on the front end - template of the plugin xxxxxx.com/docs/doc-1/ - is different from the backend when registering the meta box and custom fields.

    Could you please share some screenshots (full screen) and the code that creates the meta box, custom fields where the post ID is not retrieved?

    in reply to: Map Field not working #24068
    Long NguyenLong Nguyen
    Moderator

    Hi,

    I've tested the Google Map field with my API key on your site but not see any issue, screen record https://share.getcloudapp.com/DOuoOJ7P.

    in reply to: Empty head tag when applying View to whole page #24067
    Long NguyenLong Nguyen
    Moderator

    Hi,

    To include the header in the view, you can just use the WP function get_header()

    {{ mb.get_header() }}
    HERE WILL DISPLAY THE VIEW

    see more on this documentation https://developer.wordpress.org/themes/basics/template-files/#using-template-files.

    or add the <head> tag to show only the <head>

    <head>
    <meta charset="{{mb.bloginfo( 'charset' )}}">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="profile" href="http://gmpg.org/xfn/11">
    {{ mb.wp_head() }}
    </head>
    <body>
        HERE WILL DISPLAY THE VIEW
    </body>
    in reply to: Map Field not working #24063
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please share your admin site account via this contact form https://metabox.io/contact/. I will check it out.

Viewing 15 posts - 3,856 through 3,870 (of 4,839 total)