Change WordPress user roles and capabilities › Forums › Restrict or Permit access inside WordPress – how to › Remove Select Option Change Member Type in User List to one role › Reply To: Remove Select Option Change Member Type in User List to one role
08/10/2020 at 13:54
#7081
Vladimir
Keymaster
Fortunately ‘buddypress-member-types-pro’ plugin does not show it’s ‘Select member type’ drop-down list in case member types list is empty. So we can use this to hide it:
add_filter( 'bp_get_member_types', 'remove_bpmtp_select_member_type', 100 );
function remove_bpmtp_select_member_type( $types ) {
$user = wp_get_current_user();
if ( is_array($user->roles ) && in_array('users_administrator', $user->roles ) ) {
$types = array();
}
return $types;
}
Just replace ‘users_administrator’ at the code above with your own role ID and place this code to your active theme functions.php file or set it as a Must Use plugin.