Skip to content

Instantly share code, notes, and snippets.

@KaineLabs
Last active February 13, 2022 21:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KaineLabs/acc62194e8f66bf6e190cce1373e2986 to your computer and use it in GitHub Desktop.
Save KaineLabs/acc62194e8f66bf6e190cce1373e2986 to your computer and use it in GitHub Desktop.
Limit Profile Tab By Role.
<?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