Set Ultimate Branding adminbar menus to admin level only?

I'm willing to change/edit the core plugin code to do this if someone can just offer a simple solution.

Q: Is there a way to set a newly created custom adminbar menu so that only admin level users can see the menu?

I'm using BuddyPress with UB so all logged in users can see any extra adminbar menus I create. I want to create quicklinks to the plugins page, themes, etc. so can't be seen by regular users.

  • Vaughan

    Hi @3ring,

    Is it just a specific custom admin bar you want to hide?

    You can try adding this to your theme functions.php

    function ub_rem_admin_bar() {
        global $wp_admin_bar;
    
       if(!current_user_can('manage_options')) {
           $wp_admin_bar->remove_menu('ub_admin_bar-<menu-id>');
       }
    }
    add_action( 'wp_before_admin_bar_render', 'ub_rem_admin_bar' );

    replace <menu-id> with the menu id, which you should get from the menu item name when you view the source. it's easier using firebug, just hover over it & right click, then select inspect element. the number after the menu item is the id. in the case of the screenshot below, it's 61 so change <menu-id> to 61. so it looks like ub_admin_bar-61

    Hope this helps