Last active
February 13, 2022 21:56
-
-
Save KaineLabs/acc62194e8f66bf6e190cce1373e2986 to your computer and use it in GitHub Desktop.
Limit Profile Tab By Role.
This file contains 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 | |
/** | |
* Limit Profile Tab By Role. | |
*/ | |
function yzc_limit_profile_tab_by_role() { | |
// Get Current User Data. | |
$user = get_userdata( bp_displayed_user_id() ); | |
// Get Roles. | |
$roles = (array) $user->roles; | |
if ( in_array( 'instructor', $roles ) ) { | |
return false; | |
} | |
// Put Here The Tab Slug. | |
$tab_slug = 'instructor'; | |
bp_core_remove_nav_item( $tab_slug ); | |
} | |
add_action( 'bp_actions', 'yzc_limit_profile_tab_by_role' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment