Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: How can I make only one tab visible to users who are not logged in on Profiles?

@shanebp

Moderator

You’re looking at the templates that render the content for tabs.
But you want to remove tabs.
Because ‘groups’ may be the only tab available, you need to make ‘groups’ the default component.
You may need to add or remove one or more add_filter calls depending on your installation.
Try this in your bp-custom.php file:


define( 'BP_DEFAULT_COMPONENT', 'groups' );

function izzy_adjust_profile_nav() {
  if ( ! is_user_logged_in() ) {
	add_filter('bp_get_displayed_user_nav_activity', 'izzy_profile_nav_remove', 10, 1 );
	add_filter('bp_get_displayed_user_nav_friends', 'izzy_profile_nav_remove', 10, 1 );
	add_filter('bp_get_displayed_user_nav_forums', 'izzy_profile_nav_remove', 10, 1 );	
	add_filter('bp_get_displayed_user_nav_xprofile', 'izzy_profile_nav_remove', 10, 1 );	
  }
}
add_action( 'bp_init', 'izzy_adjust_profile_nav' );

function izzy_profile_nav_remove($nav_array) { 
  $nav_array = '';
  return $nav_array;
}
Skip to toolbar