Try this one:
/*
* Hides "Grant Roles" button, "Add Role", "Revoke Role" URE UI controls at Users list page
*/
add_filter('ure_bulk_grant_roles', 'ure_bulk_grant_roles');
function ure_bulk_grant_roles( $show ) {
$lib = URE_Lib::get_instance();
if ($lib->is_super_admin()) {
// do not hide for superadmin
return $show;
}
return false;
}
Thanks Vladimir! This is almost there. The dropdown for “Change role to …” is still showing and I would like to hide that also.
“Change role to” belongs to WordPress itself. You may revoke promote_users capability. It will hide “Change role to:”, but the “Role:” field at the user profile page too.
I don’t know if using css is the best approach but I modified the code you provided and have hidden the “Change to role …” and the associated “Change” button. This is the modified code.
/*
* Hides "Grant Roles" button, "Add Role", "Revoke Role" URE UI controls at Users list page
*/
add_filter('ure_bulk_grant_roles', 'ure_bulk_grant_roles');
function ure_bulk_grant_roles( $show ) {
$lib = URE_Lib::get_instance();
if ($lib->is_super_admin()) {
// do not hide for superadmin
return $show;
}
echo '<style>
#new_role, #new_role2, #changeit, #changeit2 { display: none; }
</style>';
return false;
}
Vladimir,
Thanks for the explanation on the “Change role” belonging to WordPress. I will handle that using CSS on the user profile page too.
I have marked this topic resolved.