Change WordPress user roles and capabilities › Forums › How to or FAQ › Custom User Edit Page › Reply To: Custom User Edit Page
07/06/2017 at 17:05
#3838
[email protected]
Participant
Vladimir,
This is the grant-roles.php file in the plugin code. I was just modifying it to debug.
The contructor instantiates $lib, and within show_grant_roles_html, its used as $this->lib, which passes through and works.
public function __construct() {
$this->lib = URE_Lib::get_instance();
public function show_grant_roles_html() {
if (!$this->lib->is_right_admin_path('users.php')) {
return;
}
// if ( !current_user_can('edit_users')) {
if ( !current_user_can('edit_users')) {
/*echo " IN show_grant_roles_html ".current_user_can('edit_users');
if(current_user_can('ga_site_administrator'))
echo " use has ga_site_administrator";
print_r(get_role('ga_site_administrator' )->capabilities);
*/
return;
}
The moment i change ga_site_administrator (which is a custom role, with edit_users capability), the to ‘edit_users’, the grant roles button disappears.
Also, another interesting thing – with my change applied – if I select 1 user and click on Grant Roles, I get URE: Insufficient Privileges. If I select 2 or more, It brings up the html for Granting Roles.
Thanks,
Shweta