Change WordPress user roles and capabilities Forums Give user access to plugin – how to How to display admin bar for some user role

Viewing 5 posts - 31 through 35 (of 35 total)
  • Author
    Posts
  • #1637
    Vladimir
    Keymaster

    Try this variant:

    add_filter('woocommerce_disable_admin_bar', '_wc_disable_admin_bar', 10, 1);
     
    function _wc_disable_admin_bar($prevent_admin_access) {
        if ( !( current_user_can('data_entry') || 
                current_user_can('operator') ||
                current_user_can('manager') ) ) {
            return $prevent_admin_access;
        }
        return false;
    }
     
    add_filter('woocommerce_prevent_admin_access', '_wc_prevent_admin_access', 10, 1);
     
    function _wc_prevent_admin_access($prevent_admin_access) {
        if ( !( current_user_can('data_entry') || 
                current_user_can('operator') ||
                current_user_can('manager') ) ) {
            return $prevent_admin_access;
        }
        return false;
    }
    
    #1638
    bikostudio
    Participant

    This one works great Vladimir! thank you so much 🙂

    #1639
    bikostudio
    Participant

    Hi, After I updated the plugin to the V.4.19 the admin bar disappeared again for the rols! 🙂

    #1640
    bikostudio
    Participant

    I discovered that i have to re-edit the role from the new user role method comping with the new version 🙂 … all done now!

    #1642
    Vladimir
    Keymaster

    Thanks for the information. It’s a strange effect. Roles editing core was not changed. So I can not repeat and explain it.

Viewing 5 posts - 31 through 35 (of 35 total)
  • You must be logged in to reply to this topic.