Skip to content

Instantly share code, notes, and snippets.

@dcavins
Created October 23, 2017 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcavins/c65f3856dd6ed5be37eef115ab09405a to your computer and use it in GitHub Desktop.
Save dcavins/c65f3856dd6ed5be37eef115ab09405a to your computer and use it in GitHub Desktop.
Prevent access to the "Friends" tab of a member profile, unless it's the user's own profile.
<?php
function bpcodex_remove_member_friends_nav_tab() {
// Stop now if:
// This isn't a user profile
// This is the current user's profile
// The user is a site admin
if ( ! bp_is_user() || bp_is_my_profile() || is_super_admin() ) {
return;
}
// Remove the "friends" item.
bp_core_remove_nav_item( 'friends', 'members' );
}
add_action( 'bp_actions', 'bpcodex_remove_member_friends_nav_tab' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment