Untested, but try:
function jake_nav_remove($nav_array) {
if( ! bp_is_my_profile() ) {
$roles = wp_get_current_user()->roles;
if (in_array('Supporter', $roles))
$nav_array = '';
}
return $nav_array;
}
add_filter('bp_get_displayed_user_nav_activity', 'jake_nav_remove', 10, 1 );
add_filter('bp_get_displayed_user_nav_profile', 'jake_nav_remove', 10, 1 );
However – removing these tabs can create problems – ‘profile’ is the default tab ( and therefore screen ) for member pages. You’ll need to decide on which tab should be default, since you may remove profile and activity.
Thank you! Should I add this to my functions.php?
This sounds like what I am trying to do.
I have a role “Partners” and the following function
function remove_nav_items() {
bp_core_remove_nav_item( 'notifications' );
bp_core_remove_nav_item( 'groups' );
bp_core_remove_nav_item( 'forums' );
bp_core_remove_nav_item( 'activity' );
}
add_action( 'bp_setup_nav', 'remove_nav_items');
How can I make an “if” statement with this function?
example: if role= ‘partners’ do remove_nav_items()
I am having trouble figuring out how to get the user role of a logged in user.