Skip to content

Instantly share code, notes, and snippets.

@imath
Created February 3, 2013 14:25
Show Gist options
  • Save imath/4701996 to your computer and use it in GitHub Desktop.
Save imath/4701996 to your computer and use it in GitHub Desktop.
this is a little BuddyPress trick to hide friends nav and activity friends subnav to members visiting other member profiles. It's a reply to this topic : http://bp-fr.net/groupes/utilisation-configuration-optimisation-de-buddypress/forum/topic/supprimer-longlet-amis-de-la-fiche-dun-membre/
<?php
/**** beginning of the code to copy in the functions.php file of active theme ****/
function mathieu_hides_friends_nav( $nav_items, $nav_items_args ) {
if( is_super_admin() )
return $nav_items;
if( bp_is_user() && !bp_is_my_profile() )
return false;
else
return $nav_items;
}
add_filter( 'bp_get_displayed_user_nav_friends', 'mathieu_hides_friends_nav', 10, 2 );
add_filter( 'bp_get_options_nav_activity-friends', 'mathieu_hides_friends_nav', 10, 2 );
/**** end of the code to copy ****/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment