Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • @asianowl

    Participant

    actually now that i think about it a little more… you should replace the current_user_can() function with the is_admin() function instead.

    @asianowl

    Participant

    here’s some clues:

    First you need to check the user’s role/capabilities and then remove the navigation menu for these users. For me, I used:

    if (current_user_can('none_admin_role')){bp_core_remove_nav_item( 'notifications');}}
    add_action( 'wp', 'bp_remove_nav_item' );

    You then still need to remove it from the admin bar. My code:

    function my_remove_admin_menu(){
    	global $wp_admin_bar;
    
    	if (current_user_can('none_admin_role'))
    	{
    		$wp_admin_bar->remove_menu('notifications');
    	}
    }
    add_action('bp_setup_admin_bar', 'my_remove_admin_menu',301);

    hopefully, this does the trick for you. I took me while to figure this out…goodluck.

    @asianowl

    Participant

    Found the solution! It was written up in the documentation! HERE

    For my needs, I filtered based on roles like so:

    function my_remove_activity_menu(){
    	if (current_user_can('special_role'))
    	{
    		global $wp_admin_bar;
    
    		$wp_admin_bar->remove_menu('my-account-activity');
    	}
    }
    add_action('bp_setup_admin_bar', 'my_remove_activity_menu',301);
    

    Good luck everyone.

    @asianowl

    Participant

    after a shower — it came to me that I should just hide the menu item in CSS with the following:
    #wp-admin-bar-my-account-activity{display:none;}

    But this hides it from everyone… does anyone else have a better idea?

Viewing 4 replies - 1 through 4 (of 4 total)
Skip to toolbar