Created
October 23, 2017 17:39
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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