Custom Admin Bar Plugin: Show / Hide per Role?

(I've not installed the Custom Admin Bar plugin yet because I don't think it has this capability.)

I am using S2 Members Pro for payment, membership, etc. I have the traditional roles Editor through Admin. S2 Members also provides at least four additional roles, Level1, Level2, Level3, Level4. Currently, I use a plugin to suppress the Admin Bar for these paying customer roles. But I am considering whether I could show the admin bar if I could control what a Level1 through 4 user can see.

So, can your Custom Admin Bar Plugin display different information by role? Example: For paying members I would show one set of links, for Editor through Admin I would show a different set of links.

Thank you,
Bob

  • Vaughan
    • Support/SLS MockingJay

    Hi @bob,

    Currently, no, this is not supported, but I can certainly add this to the features list for the developers to look at in a future release.

    Be aware, that Ultimate Branding is the main plugin used for this now and has custom admin bar features built in which has superseded the custom admin bar plugin & is more up to date. But custom admin bar by roles is certainly being looked at in a future release as it is becoming a popular request.

    Hope this helps

  • Bob
    • WPMU DEV Initiate

    Here's what I already have to modify the bar. I've not yet done it on a per-role basis ... I might experiment on that over the weekend. Here's what I added in the theme's function.php:

    function mytheme_admin_bar_render() {
          global $wp_admin_bar;
          $wp_admin_bar->add_menu( array(
            'parent' => '',
            'id' => 'all_pages',
            'title' => __('All Pages'),
            'href' => admin_url( 'edit.php?post_type=page')
          ));
          $wp_admin_bar->add_menu( array(
            'parent' => '',
            'id' => 'all_users',
            'title' => __('All Users'),
            'href' => admin_url( 'users.php')
          ));
          $wp_admin_bar->add_menu( array(
            'parent' => '',
            'id' => 'cs_asp',
            'title' => __('CS-ASP Series'),
            'href' => admin_url( 'post.php?post=12677&action=edit')
          ));
        }
        add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );

    And it created the result in the attached image. You can see I added several shortcuts to things that were important to me. However, I would have to dig deeper to add the notion of roles.

    I can't recall which article I used as reference ... just Google: mytheme_admin_bar_render()

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.