[Resolved] Hiding WordPress admin bar from non admin users.
-
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.
-
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 );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!
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 );Hi again. I did as you stated, but that isn´t working, the WordPress adminbar is still there…Thanks again.
Erik.
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!
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.
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!!
Haven’t tested it myself but try this plugin:
https://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/That absolutely did the trick!! Awesome. THANKS!!!
- The topic ‘[Resolved] Hiding WordPress admin bar from non admin users.’ is closed to new replies.