• Resolved jimmykwk

    (@jimmykwk)


    Hi, thanks for this awesome plugin.
    How do I hide “Renumerate Orders” menu under WooCommerce parent menu for Shop Manager role?
    I tried this but it didn’t work

    
    add_action('admin_menu', 'remove_unused_shopmanager_menu', 11);
    
    function remove_unused_shopmanager_menu()
    {
        $user = wp_get_current_user();
    
        if ( in_array( 'shop_manager', (array) $user->roles ) ) {
            remove_submenu_page('woocommerce', 'alg-wc-renumerate-orders-tools');
        }
    }
    
    • This topic was modified 7 years, 9 months ago by jimmykwk.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @jimmykwk,

    Thanks for the idea – I will add option to hide menu for shop managers in next version.

    Meanwhile – your code is not working because you are calling your function too early. Our function is attached to admin_menu with PHP_INT_MAX priority and yours with 11. So I would suggest at first trying to use PHP_INT_MAX as priority, i.e.:

    
    add_action( 'admin_menu', 'remove_unused_shopmanager_menu', PHP_INT_MAX );
    

    And if this won’t work – try attaching it through init hook, i.e.:

    
    add_action( 'init', 'attach_remove_unused_shopmanager_menu' );
    function attach_remove_unused_shopmanager_menu() {
        add_action( 'admin_menu', 'remove_unused_shopmanager_menu', PHP_INT_MAX );
    }
    

    Hope that helps. And if you like the plugin, please consider leaving us a rating.

    • This reply was modified 7 years, 9 months ago by Algoritmika.
    Thread Starter jimmykwk

    (@jimmykwk)

    Thanks @algoritmika, solved with PHP_INT_MAX priority on admin_menu hook.

    Happy to hear it’s working @jimmykwk! Please let me know if you need anything else.

    Hi @jimmykwk,

    Just wanted to let you know that I’ve just released new plugin version 1.2.2 and there, as promised, I’ve added two new options:

    • Hide “Renumerate Orders” admin menu for roles
    • Hide “Custom Order Numbers” admin settings tab for roles

    Hope that will be useful for you.

    Thread Starter jimmykwk

    (@jimmykwk)

    Hi @algoritmika, that’s awesome! thank you very much!

    Sure, no problem @jimmykwk. Happy to help.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Hide Renumerate Orders Menu’ is closed to new replies.