Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 841 through 855 (of 3,702 total)
  • Author
    Posts
  • 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.

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

    Hi Mary,

    I've just checked and couldn't replicate the error. I recorded a video here:

    https://www.loom.com/share/b309930905274434abebd1ab3c7ef0ea

    Please take a look.

    If you still see the problem, please send me more details or a temporary admin account via the Contact form. I'll take a closer look to your site.

    in reply to: For loops in MB Blocks with MB Builder #15673
    Anh TranAnh Tran
    Keymaster

    This bug is fixed in version 1.0.3. New version for AIO will come a little later.

    in reply to: Choice fields filter not working on clonable field #15672
    Anh TranAnh Tran
    Keymaster

    Hi Ryan, this bug is fixed in this commit.

    in reply to: Choice fields filter not working on clonable field #15667
    Anh TranAnh Tran
    Keymaster

    Oh, I see the problem. After saving, only the 1st input has the filter working. I'll fix it now.

    in reply to: Taxonomy Advanced - display category thumbnail image #15666
    Anh TranAnh Tran
    Keymaster

    Hi Wojtek,

    If you're on a category/term page, then you can get the term id with get_queried_object_id(). You can also get full term object with get_queried_object().

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

    Hi Mary,

    Do you see any error in the browser console?

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