Created
March 3, 2018 15:01
-
-
Save dcavins/e7708f2a58aab16b61bbf7b06acf9756 to your computer and use it in GitHub Desktop.
Don't allow people to see a subscriber's profile tab.
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
add_action( 'bp_actions', function() { | |
if ( ! bp_is_user() || is_super_admin() ) { | |
return; | |
} | |
$user_meta = get_userdata( bp_displayed_user_id() ); | |
if ( in_array( 'subscriber', $user_meta->roles ) ) { | |
bp_core_remove_nav_item( 'profile', 'members' ) | |
} | |
}, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this accomplished the blocking of profile page but still gives subscriber access to it's other pages like messages/ buddydrive.
add_action( 'wp', function() {
if ( bp_is_user_profile() ) {
$user_meta = get_userdata( bp_displayed_user_id() );
}, 1 );