Buddypress hide the top level tabs from users ( e.g. hide the group tab)

This is to hide the top level tabs from users. Based on this code from the buddypress forums.

buddypress pr

define( 'BP_DEFAULT_COMPONENT','profile' ); // this shows something if no tabs (otherwise 404)
function bpfr_hide_tabs() {
 
	if ( bp_is_user() && !is_super_admin()  ) {
        
        /* and here we remove our stuff ! */
		//bp_core_remove_nav_item( 'activity' );
		//bp_core_remove_nav_item( 'friends' );
		bp_core_remove_nav_item( 'groups' );
		bp_core_remove_nav_item( 'forums' );
	}
	
}
add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );

 

Leave a Comment