Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Hiding WordPress admin bar from non admin users.

  • Avatar of erikahrend
    erikahrend
    Member

    @erikahrend

    Hi all. I would like to have the Buddypress admin bar visible at all times in my site for logged in users, but I want to completely hide the WordPress adminbar from non-admin members (I only want the admins to be able to see it). How can this be achieved? Please bear in mind that my coding skills are very limited, a detailed explanation would be most appreciated.

    Thanks in advance, all the best.

    Erik.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Avatar of @shawn38
    Anonymous

    Place this in your childthemes functions.php just after the opening php tag:

    //Removes BuddyBar from non-admins only
    if (!current_user_can(‘manage_options’)){
    define ( ‘BP_DISABLE_ADMIN_BAR’, true );

    Avatar of erikahrend
    erikahrend
    Member

    @erikahrend

    Hi, thanks for your kind reply. I appreciate, but that completely removes the adminbar (including the Buddybar). I want to remove the WORDPRESS admin bar alone from non admins, but NEVER the Buddypress adminbar, which I want to have visible at all times…..

    Possible?

    Thanks!

    Avatar of @shawn38
    Anonymous

    Okay gotcha! Put this in your child themes functions.php after the opening php tag :

    if (!current_user_can(‘manage_options’)) {
    add_filter(‘show_admin_bar’, ‘__return_false’);
    }

    function stp_no_admin_access()
    {
    if( !current_user_can( ‘administrator’ ) ) {
    wp_redirect( home_url() );
    die();
    }
    }
    add_action( ‘admin_init’, ‘stp_no_admin_access’, 1 );

    Avatar of erikahrend
    erikahrend
    Member

    @erikahrend

    Hi again. I did as you stated, but that isn´t working, the WordPress adminbar is still there…Thanks again.

    Erik.

    Avatar of @shawn38
    Anonymous

    The admin bar displays different for admins and subscribers anyway. It has admin functionality built in that a normal subscriber would not have. In short they don’t have admin options. So what are you really trying to do because it doesn’t make any sense!

    Avatar of @shawn38
    Anonymous

    If you don’t want the bar showing up for non-logged in users then go to dashboard/settings/buddypress/settings and uncheck show the toolbar for logged out users.

    Avatar of erikahrend
    erikahrend
    Member

    @erikahrend

    Hi. Maybe I didn´t explain properly. When users log in, they see the wordpress logo to the left and an access to the blog´s (subscriber)dashboard. I want to completely eliminate the references to WordPress in the left of the adminbar, but retain the Buddybar in the right..

    make sense?

    Thanks!!

    Avatar of @shawn38
    Anonymous

    Haven’t tested it myself but try this plugin:
    http://wordpress.org/extend/plugins/ag-custom-admin/
    If that doesn’t do the trick and nobody else can guide you then you may want to consider hiring a developer and posting it here: http://jobs.wordpress.net/

    Avatar of erikahrend
    erikahrend
    Member

    @erikahrend

    That absolutely did the trick!! Awesome. THANKS!!!

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

You must be logged in to reply to this topic.