Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 841 through 855 (of 3,708 total)
  • Author
    Posts
  • in reply to: Custom block not saving #15729
    Anh TranAnh Tran
    Keymaster

    Hey Steven,

    I've just updated MB Blocks to 1.0.4 to address this issue. I have confirmed with Alex that it's working. Please update the extension.

    in reply to: Conditional logic fails on switch in 1.6.6 #15727
    Anh TranAnh Tran
    Keymaster

    Hey guys,

    Thanks for your feedback. Based on what FED offered, I think this patch is a little better. Can you please try replace the line 240 in the conditional-logic.js with this?

    if ( ! isGutenbergElement( logic[0] ) && ! dependentFieldSelector && $scope && $scope.hasClass( 'rwmb-group-clone' ) ) {
    

    I'll release a new version when it's confirmed. Thanks!

    in reply to: datetime field error #15726
    Anh TranAnh Tran
    Keymaster

    Hi, this bug is fixed here. New version of Meta Box will come next week.

    in reply to: Sanitization of Fields input #15719
    Anh TranAnh Tran
    Keymaster

    Hi David,

    Your feedback is great and that's exactly what I'm looking for. My reply above was just a discussion about your ideas.

    I'll consider your suggestions. Thanks.

    in reply to: Some field types are not displayed within the block #15718
    Anh TranAnh Tran
    Keymaster

    Hi, I've tested with your code and it works. Please see my video: https://www.loom.com/share/b104b120c7d64513a7b7a1e10f605949

    Please try clear the browser cache and try again. I guess some scripts are missing. Please check the console as well.

    in reply to: Meta not displaying in Live Preview or Front end #15717
    Anh TranAnh Tran
    Keymaster

    Hi,

    I found the problem. You're using a child theme, and in the register.php function that registers the block it refers to the parent theme folder:

    'render_template' => get_template_directory() . '/blocks/hero/template.php',
    'enqueue_style'   => get_template_directory_uri() . '/blocks/hero/style.css',

    It should change to:

    'render_template' => get_stylesheet_directory() . '/blocks/hero/template.php',
    'enqueue_style'   => get_stylesheet_directory_uri() . '/blocks/hero/style.css',

    I made the change in your site and it works.

    in reply to: Addition of labels view for taxonomy field? #15712
    Anh TranAnh Tran
    Keymaster

    Hi,

    Yes, it's possible.

    You can use the taxonomy_advanced field, and set the field_type to select_advanced (default) and enable multiple to true, like this:

    'fields' => [
        [
            'id' => 'purchased_tags',
            'type' => 'taxonomy_advanced',
            'taxonomy' => 'your_tax',
            'name' => 'Apply tags when purchased',
            'field_type' => 'select_advanced',
            'multiple' => true,
        ],
        // Other fields
    ]
    in reply to: Sanitization of Fields input #15711
    Anh TranAnh Tran
    Keymaster

    Hi David,

    Thanks for your feedback. Yes, I want to complete this thing as it's important and I don't want to postpone at the middle.

    Regarding your feedback:

    1. I think sanitize_textarea_field is too limited. It seems fine with the function name, but people usually use it for HTML content. I'm using wp_kses_post, which I think is okay.
    2. Adding params for wp_kses_post can be done. But it will make the code more complicated in both plugin's side and developer's side. I think in this case, developers can do that easier with a custom sanitize callback like this:
    'sanitize_callback' => function( $value ) {
        $allowed_tags = [];
        return wp_kses( $value, $allowed_tags );
    }
    1. I'm thinking about this, too. Need to find a good way to implement that without breaking things.
    2. That's available via custom sanitize_callback param (see the example above). Developers can define their own sanitize callback or bypass the sanitization with this code:
    'sanitize_callback' => function( $value ) { return $value; }
    
    in reply to: Some field types are not displayed within the block #15710
    Anh TranAnh Tran
    Keymaster

    Hi,

    Are you using the AIO plugin or MB Blocks plugin individually? I fixed this bug in MB Blocks, but haven't deployed to API yet.

    in reply to: Sanitization of Fields input #15706
    Anh TranAnh Tran
    Keymaster

    Hi David,

    Glad you like it. I've just pushed the finished code to the "sanitize" branch. The full code is now available here.

    There are also some things left that I would love to hear your feedback:

    • textarea field: at the moment, I force to use wp_kses_post as default. But as I said in a reply earlier, some developers make this field available for users to enter scripts (such as Google Analytics or Google Adsense). What do you think best in this way? Is forcing a callback is good?
    • Custom field type are not sanitized by default. Developers are required to sanitize themselves. Do you think it's fine? Or forcing a default sanitize callback?
    in reply to: metabox info #15699
    Anh TranAnh Tran
    Keymaster

    Hi,

    This is similar to what we've done in the MB REST API plugin. Please take a look at the plugin code to see how it's done.

    in reply to: Sanitization of Fields input #15698
    Anh TranAnh Tran
    Keymaster

    Hey guys,

    I added some sanitization callbacks. More will come later. The full code of the sanitization is here.

    This is the 1st step on this. Any feedback is welcomed.

    in reply to: Taxonomy fields not clonable? #15687
    Anh TranAnh Tran
    Keymaster

    Yes, that can be done with this filter:

    https://docs.metabox.io/actions/#rwmb_field_id_after_save_field

    add_action( 'rwmb_YOUR_FIELD_ID_after_save_field', function( $null, $field, $new, $old, $object_id ) {
        $term_ids = $new;
        if ( $field['clone'] ) {
            $term_ids = [];
            foreach ( $new as $clone_value ) {
                $term_ids = array_merge( $term_ids, $clone_value );
            }
        }
        wp_set_post_terms( $object_id, $term_ids, 'YOUR_TAXONOMY' );
    }, 10, 5 );
    in reply to: Migration Issue #15686
    Anh TranAnh Tran
    Keymaster

    Hi,

    Did you change the code for fields when migrating the site? That might be the problem. The structure of the meta box and fields need to be the same in the previous site.

    You can also try to var_dump the value (sometimes you need to unserialize it first if that's a group), to see the data structure. And verify that with the meta box/fields structure to make sure they match.

    in reply to: datepicker not showing on front end #15685
    Anh TranAnh Tran
    Keymaster

    I see. Removing the "content" from the shortcode breaks the date picker. I've just fixed it in this commit. Please try it. The new version is coming soon.

Viewing 15 posts - 841 through 855 (of 3,708 total)