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.
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);