0

I have setup my WordPress installation with a custom role called 'regional_manager'

I have given this role the capability to add_users and managed to create a custom snippet for my functions.php file which only lists subscribers in the Role drop down. This means that the regional_manager role can only create new users with a role of subscriber.

Now I would like to prevent them from seeing all other users when they go to

www.mydomain.com/wp-admin/users.php

Is there a simple way to do this and does anyone have an example of something similar they can point me in the direction of?

1 Answer 1

0

If you look at the source of that file at the very top there is capability check:

if ( ! current_user_can( 'list_users' ) )
    wp_die( __( 'Cheatin’ uh?' ) );

So list_users seems like a perfect starting point (at least) to remove from your custom role. However it is hard to say what else it might affect without thoroughly testing out all parts of admin your user should and should not be able to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.