Public Ticket #3293298

categories limit and categories allowed

Closed
Comments
2,762
KingsPlugins replied 4 years ago on March 11, 2023 at 4:00pm

Hi Martin,

Thank you for your feedback,


We will consider adding these in future updates,


If that can help, I can provide you with a PHP hook so you can set a categories limit programmatically (by vendor group ID).


Kind regards,

Stefan

1
2,762
KingsPlugins replied 4 years ago on March 13, 2023 at 9:40am

You can add the following PHP code snippet to your site:

add_action('marketking_dashboard_head', function(){
    $user_id = get_current_user_id();
    $vendorgroup = intval(get_user_meta( $user_id, 'marketking_group', true ));
    if ($vendorgroup === 123){
        ?>
        <script>
            jQuery(document).ready(function(){
                jQuery("#marketking_select_categories").select2("destroy");
                jQuery("#marketking_select_categories").select2({
                    maximumSelectionLength: 3
                });
            });
        </script>
        <?php
    }
    
});

This sets a limit of 3 categories for vendors with the group with ID 123.

1
14 Tickets 4
Martin replied 3 years ago on April 20, 2023 at 11:15pm

Because the categories data is large, difficult to setting include categories at vendor group section.

How can it code here PHP with include and exclude function? add up to the code of categories limit you provided. Thanks for help!

----------------------------------------------------

I put the code at SNIPPET works fine.

It not work at the Child Theme: functions.php, it can be ignored.

Sign In