User Role Editor WordPress plugin – Change roles easily

User Role Editor - plugin for WordPress

User Role Editor

User Role Editor WordPress plugin allows you to change standard WordPress user roles capabilities with easiness of a few mouse clicks. Just turn on check boxes of capabilities you wish to add to the selected role and click “Update” button to save your changes. That’s done. Add and tune your own custom roles which you can assign to the users then. You can create new role as a copy of existing one. Delete self-made roles. Change defaul user role.
Multi-site support is provided.

Why it could be necessary? Let’s suppose you wish that your multi-authored blog contributors upload their own graphics to use in their posts. WordPress “contributor” role has no such capability by default. In such situation you have needed to change user role capabilities manually using SQL client as I described at “How to change wordpress user role capabilities” post, if you have enough knowledge in that field. But what to do if you have not?


Good news – This task is simple now, just use this plugin

User Role Editor

The latest version: 3.14.1. Quant of downloads: 636986
download

Take a look at the “User Role Editor” plugin main form screenshot:
User Role Editor main form

  • Select a role you wish to change from the drop down list at the top. Page will be refreshed automatically and show you the capabilities list for the selected role. Make your corrections, check/uncheck correspondent check boxes and click “Update” button to save your changes. If you wish to apply this change for all sites of your multi-site WordPress network, turn on “Apply to All Sites” check box at the top of the form before press “Update”.
  • If you prefer to see capabilities names in form e.g. ‘Edit pages’ instead of WordPress ‘edit_pages’ standard form turn on the “Show capabilities in human readable form” checkbox at the right top corner of the main form. Move mouse over capability name and you will see its alternative form name.
  • According to WordPress Codex User Levels were introduced in WordPress 1.5, they were replaced by Roles and Capabilities in WordPress 2.0, and were finaly deprecated in WordPress 3.0. Thus you can hide them in order they do not mess you in your work with roles. Keep “Show deprecated capabilities” check box at the to right corner of the form unchecked for that. If for any reason you need to see user levels, turn on that check box.
  • If you don’t wish to save changes you can click “Cancel” button.
  • If you are needed to restore roles capabilities you have before your or installed plugins made 1st modification to them, use “Reset” button. “User Role Editor” will restore roles and capabilities to its clean state. You will get roles stuff just after WordPress installation. Be very careful with this operation as you will definitely lose any changes you or your plugins made to user roles from the time of fresh WordPress installation. Consider to make backup copy of your database before proceed with “Reset” operation.

In order to add/remove your custom role, change default role for new user, add/remove custom user capability use “User Role Editor” management boxes, look on screenshot below:
User Role Editor custom roles and capabilities management boxes

  • If you need your own custom role, create it with “Add New Role” feature. Input new role name into input text field at “Add New Role” box, select existing role from drop-down list if you wish to use its capabilities as starting point for further work and click “Add” button. Remember that you can use latin letters, digits and an “_” underscore sign in your role names. Subscriber role is copied by default if you don’t select such role yourself.
  • Unnecessary self-made role can be deleted with “Delete Role” box. Select role and click “Delete” button for it. Only your self-made roles appears in the role list to delete. If some of your own roles is assigne to the user or selected as default role for new users it will not be appeared in the list for deletion.
  • Select the role which you wish to use as default for any new created user from the list at “Default Role for New User” box. Click “Change” button to save your changes.
  • Use “Add New Capability” box in order to add new user capability. Remember you can use only latin alphabet letters, digits and underscore sign in the capability name. How to use new added user capability? Turn it on in the role you select and check if current user has such capability in your plugin or active theme functions.php file. For example,
     if (!current_user_can('some_capability_you_added')) {
       echo "You don't have permission for it!";
       return;
    }
  • If you need delete custom capability added by you or some of your old plugins, which you don’t use anymore use “Delete Capability” box. “User Role Editor” doesn’t allow to delete built-in WordPress capabilities.

With help of “User Role Editor” you can assign additional capabilities directly to the users. Open users list by click on the “All Users” link at the “Users” submenu. Find needed user, move mouse pointer to his name and click “Capabilities” link as on screenshot below:
User Capabilities Editor link
At the form opened you can assign to user another role and/or add to him capabilities which not included to his role:

Change User Capabilities

Change User Capabilities


You can not turn off capabilities included to the role assigned to this user. You can add/remove other capabilities. They will be applied directly to the user as you click the “Update” button. If you wish to built a fully custom capabilities set for this user, without limitation of any role, select “No role for this site” from drop-down list at the top and make it.

For more information about WordPress user roles please read these articles
- WordPress Admin Menu Permissions;
- WordPress user capabilities;
- activate_plugins WordPress user capability;
- edit_dashboard WordPress user capability;
- Delete posts and pages WordPress user capabilities set;
- delete_plugins WordPress user capability;
- moderate_comments WordPress user capability;
- Roles and Capabilities article at codex.wordpress.org;

If you can not find answer for some question yourself, consider to subscribe for one year Premium support and get your answer in guaranteed 24 hours. Pay $15 only and priority in conversations about WordPress user permissions, roles and capabilities related problems, other plugins menu access, etc. will be yours for the whole year.
Buy Now

Translations

Русская версия этой статьи доступна по адресу ru.shinephp.com

Dear plugin User,
if you wish to help me with this plugin translation I very appreciate it. Please contact me via Contact form and I will answer you by email. Do not forget include your site link in order I can show it with greetings for the translation help at shinephp.com, plugin settings page and in this readme.txt file. If you have better translation for some phrases send it to me. You are welcome!
Former translators! Please check your translations and provide the updated files corresponding to the current version of URE plugin.

Special Thanks to

  • Lorenzo Nicoletti – for the code enhancement suggestion CUSTOM_USER_META_TABLE constant is used now for more compatibility with core WordPress API.
  • Marcin – For the code enhancement. This contribution allows to not lose new custom capability if it is added to other than ‘Administrator’ role.
  • FullThrottle – for the code to hide administrator role at admin backend.

You are welcome! Help me with bugs catching, share with me new ideas about plugin further development and link to your site will appear above.

Recent donations for this plugin developement

Change Log

3.14.1

  • 24.05.2013
  • Bug, which prevented the correct use of WordPress nonces on some installations (Windows), is fixed;
  • DIRECTORY_SEPARATOR constant used in path to User Role Editor CSS file was empty on some installations (Windows). Constant DIRECTORY_SEPARATOR is excluded from the plugin code;
  • User capabilities page: roles checkboxes are excluded from 'Select All', 'Unselect All', 'Inverse' operations. Only capabilities checkboxes are processed.
  • Turkish Muhammed YILDIRIM translation is updated.

3.14

  • 17.05.2013
  • Interface update: role/capability add/remove stuff was removed from the page. Plugin has toolbar at the right side now. Click on the button opens needed dialog window.
  • New role may have different attrubutes "ID" and "Name". While ID is still restricted by latin characters hyphen, underscore and digits only, Name could contain spaces and national languages characters.
  • General code cleanup and security enhancements: all data changes request are processed via POST instead of GET now. So its more difficult to send modified malicious request without special software. Presence of special nonce field is checked for all requests.
  • Setting up the 'administrator' role as default one for new registered users is prohibited at server side.
  • JavaScript code separated from PHP one whenever it's possible.

  • 14.05.2013

  • Update for administrators of multi-site WordPress installations. Single-site WordPress installation administrator could skip this update.
  • "Apply to All Sites" feature did not work at version 3.12. It is fixed.
  • "Apply to All Sites" feature is available now from main site of the network only

3.12

  • 01.05.2013
  • Critical update: persistent cross-site scripting vulnerability is fixed.
  • WordPress built-in constants, like WP_PLUGIN_URL are not used in order to provide compatibility with sites which use SSL. plugin_dir_url(), plugin_dir_path() functions are used to define paths to the plugin's files instead.
  • "Greetings" section is removed from the plugin's main page. All that content is still available at plugin page

3.11

  • 24.03.2013
  • Required WordPress version checking is moved to plugin activation hook.
  • Administrator can now exclude non-core (custom) capabilities from his role. It is useful if you need to fully remove some capability as capability deletion is prohibited while it is used at least one role.
  • bbPress compatibility issue is fixed: capabilities created by bbPress dinamically are excluded from the capabilities set in User Role Editor to not store them in the database as persistent WP roles data.
  • Additional roles are assigned to user without overriding her primary WordPress role and bbPress role.
  • Changing Wordpress user primary role at user profile doesn't clear additonal roles assigned with User Role Editor earlier.
  • Brasilian Portuguese translation is updated.

3.10

  • 04.02.2013
  • You can assign to user multiple roles simultaneously. Use user level roles and capabilities editor for that. You can click 'Capabilities' link under selected user row at users list or 'Assign Roles and Additional Capabilities' link at user profile.
  • Critical bug fix: hidden deprecated WordPress core capabilities had turned on after any update made to the role. Deprecated capabilities are not currently in use by WordPress itself. But old plugins or themes could still use them. If you use some outdated code I recommend you to check all roles, you modified with User Role Editor, and turn off unneeded deprecated capabilities there.
  • User with Administrator role is secured better from editing, deletion by user with lower capabilities.

3.9

  • 07.01.2013
  • Compatibility with bbPress 2.2 new user roles model is provided. More details about the reason of such update at http://shinephp.com/bbpress-user-role-editor-conflict-fix/
  • "Reset" button works differently now. It restores WordPress roles data to its 1st, default state, exactly that, what WordPress has just after fresh install/latest version update. Be careful with it, make database backup copy before fulfill this operation. Some plugin could require reactivation to function properly after roles reset.
  • Arabic translation is added. Thanks to Yaser
  • Slovak translation is added. Thanks to Branco

3.8.3

  • 14.12.2012
  • Compatibility issue with WordPress 3.5 was found (thanks to Sonja) and fixed: $wpdb->prepare() was called without 2nd $args parameter - removed.

3.8.2

  • 02.12.2012
  • load_plugin_textdomain() call moved to the 'plugins_loaded' hook for higher compatibility with translation plugins.
  • Traditional Chinese translation is added. Thanks to Jingxin Lai.

3.8.1

  • 21.10.2012
  • Fix: URE taked roles names from the database directly and ignored changes made to roles names on the fly by other plugins or themes, names, which were cached by WordPress internally, but were not written to the database. URE uses WordPress internal cache now.
  • Roles names translation update: if URE translation file doesn't exist for blog default language, URE uses WordPress internal translation now.
  • Serbian translation is added. Thanks to Diana.

3.8

  • 01.09.2012
  • Bug fix: Some times URE didn't show real changes it made to the database. The reason was that direct update of database did not invalidate data stored at WordPress cache. Special thanks to Knut Sparhell for the help to detect this critical issue.
  • WordPress core capabilities are shown separately from capabilities added by plugins and manually.
  • If you configured URE to show you 'Administrator' role, you will see its capabilities, but you can not exclude any capability from it. I may just add capabilities to the Administrator role now. The reason - Administrator role should have all existing capabilities included.
  • Brasilian Portuguese translation is updated. Thanks to Onbiz.

Click here to look at the rest part of User Role Editor changelog.

FAQ

- Does it work in multi-site environment?
Yes, it works with multi-site installation. By default plugin works for every blog from your multi-site network as for locally installed blog without multi-site feature.

URE Multi-site feature

URE Multi-site feature


To update selected role globally for all Network you should turn on the “Apply to All Sites” checkbox.

- How to duplicate my custom created roles from main blog of my multi-site network to new created one?
“User Role Editor” makes it for you automatically. As new blog added to your network, “User Role Editor” copies full roles staff from your main blog to the new created one.

- Why administrators of single site of multi-site network do not see “User Role Editor” under “Users” menu?
URE is disabled for single site administrator by default. If you wish to enable it for single site adminitstrator add this line of code into your blog wp-config.php file

define('URE_ENABLE_SIMPLE_ADMIN_FOR_MULTISITE', 1);

- I have large multi-site network. After click “Update” button with “Save to all sites” checkbox turned on nothing is happened. I got the blank page.
It is PHP script execution time limit problem. Other network update method is available as alternative from version 3.5. Due to my tests it works approximately 30 times faster. Try it. It will be great, if you share your experience with me. In order to select alternative method of all sites update add this line to you blog wp-config.php file

define('URE_MULTISITE_DIRECT_UPDATE', 1);

It does nothing automatically, just select other algorithm when you press “Update” with “Apply to All Sites” checkbox turned on next time.
If you define WP_DEBUG equal to 1 or true constant in wp-config.php file, URE with this directive shows update execution time in milliseconds as additional technical information.

- How to edit “Administrator” role? I don’t see it in the roles drop down list.
“Administrator” role is hidden from the roles drop down list by default.
You can see/edit “Administrator” role starting from version 3.4. Insert this line of code

  define('URE_SHOW_ADMIN_ROLE', 1);

into your wp-config.php file and login with administrator account for that.
If for any reason your “Administrator” role missed some capabilities added by plugins or themes, you can fix that now. But be careful with changing “Administrator” role, do not turn off accidentally some critical capabilities to not block your admin users.

- Does it work with WordPress versions prior 3.0?
Starting from version 2.2 plugin works with WordPress 3.0 and higher only. For earlier WordPress versions use plugin version 2.1.10

download

I am ready to answer on your questions about this plugin usage and help with possible problems. Use User Role Editor plugin forum or this page comments and site contact form for that please.

Thanks,
Vladimir ShinePHP.com

Tags: , , , ,

  • Дарья

    странно, но не помогло….

  • Vladimir Dobrev

    any way to limit to specific post category, so we can have one person editing “software” post and another “hardware” post only..

  • http://shinephp.com Vladimir Garagulya
  • Vladimir Dobrev

    thanks, will try immediately ;)

  • Jane

    Hi, The plugin works well, just one issue I cannot solve though – I have set the user role of ‘ Manager’ so that another person can do all things except change themes and plugins… when logged in as Manager though, there is not a link for pages in the left column and so cannot find or edit existing pages?

  • http://shinephp.com Vladimir Garagulya

    Hi, It seems you should see posts and pages menus with this capabilities list. May be some plugin hides them? Did you try Manager role with other plugins deactivated?

  • Roger Soriano

    I would to know, which file I need to edit to create a new costume capability.

  • Roger Soriano

    Hello Vladimir
    Congratulations for your great plugin
    I would to know, which file I need to edit to create a new costum capability.
    I want to create a new capability, to let some users see an especific div. Is that posible? (It’s as the capability see_private_pages, but with hidden divs[that have display=none, in css style]). I want to let them see the hidden divs, or just with js create a function, that if the user has this capability: display = inherit.
    something like that. If you could say me which file i have to edit to create a ned capability, it would be great.
    Thanks for your time!

  • http://shinephp.com Vladimir Garagulya

    Hi Roger,

    There is no need to edit any files to create new custom capability. At the bottom part of User Role Editor page you see few boxes. One of them is named ‘Add New Capability’. Just turn on new added capability in selected roles then. That’s all.
    The rest part is to check if user has that capability and act accordingly. I think that your page footer is right place to add javascript code for that there. Look for the footer.php file at your current theme folder, or other one which contains code for the footer. If you make your hidden ‘div’s with the same class name, you may conditionally add JQuery ‘ready’ event, which will change all those hidden divs visibility.
    To check if user has needed capability in PHP use this condition:
    if (!current_user_can(‘some_capability_you_added’)) {
    // bla-bla-bla
    }

    Regards,
    Vladimir.

  • steph

    Hi there and thank you so much for a very useful plugin!

    We’re using your plugin in a multisite environment.

    We’d like to create a capability something like “delete_administrator_pages”, so that if it is left unchecked, an Editor could not delete pages created by an Administrator, but they could still delete pages created by Other Editors. We want them to be able to view & edit Administrator-created pages, just not be able to delete them.

    Right now, if we uncheck the “delete_others_pages”, they can’t delete anyone else’s pages, but we want them to be able to delete other editor pages, just not pages created by Administrators. I tried adding this new capability through your plugin, but not sure what other code I need to modify.

    Thank you!

  • Thomas Kirven

    Hey, thanks for such a great plugin!

    Can you help me understand how to apply a custom capability to a WooCommerce Product, which, I think, is a custom post type?

    Thank you!

  • http://shinephp.com Vladimir Garagulya

    Hi,

    It seems that it’s possible to resolve your task.

    When user tries to move page into trash WP executes has_cap() routine to check if user has ‘delete_page’ meta capability which is mapped via map_meta_cap() function to ‘delete_others_pages’, ‘delete_published_pages’ for published page. Finally has_cap() checks if user has all capabilities returned by map_meta_cap(). Thanks to WordPress developers, we have ‘map_meta_cap’ filter at the end of map_meta_cap() function. Thus, if you add ‘delete_administrator_pages’ capability to the capabilities list user must have to delete administrator’s pages, with the help of this filter, your task will be resolved.
    Please let me know if you need further help.

    Regards,
    Vladimir.

  • http://shinephp.com Vladimir Garagulya

    Hi,

    You are right, WooCommerce Product is a custom post type. WC defined custom capability for it with name ‘product’: edit_product, edit_products, etc… Look into User Role Editor custom capabilities section. You will find a lot of custom capabilities defined by WC plugin itself, and they are not only product related.

    Regards,
    Vladimir.

  • Thomas Kirven

    Thank you :)

    Would you also be able to help me with this…?

    How would I hide the username field on a registration form and have it auto-populate with what the registeree types for their e-mail address? Basically, I want the username to be assigned by the e-mail address they enter.

    Thank you!

  • steph

    Thanks for your quick reply! I added the ‘delete_administrator_pages’ capability through your plugin on the admin page. I kept check marks for the Editor next to ‘delete_others_pages’ so they could continue to delete other Editor’s pages, but left the new check box next to ‘delete_administrator_pages’ blank so they couldn’t delete any pages created by the Administrator. However, at this point, they can still delete admin pages. Do I need to also edit some php? Specifically in the capabilities.php file within the ‘delete_page’ case? I’m a bit new to this, so any help is very much appreciated.

    Thanks so much again –

    Steph

  • Dave

    Hi Vladimir. This is a very nice plugin. I want to make a role which is able to edit others posts (edit_others_posts) but i want to see the changes before its public and confirm to them. Do you know what I mean? Is that possible?

  • http://shinephp.com Vladimir Garagulya

    Hi Dave,
    I think – Yes. Read this post, I hope it will help you
    http://shinephp.com/change-published-to-pending/

  • Dave

    thank you for the fast answer. It doesnt quite work yet. I tried both codes on the site you sent me. i get this line just below the admin bar which doesnt go away. what can i do?

  • http://shinephp.com Vladimir Garagulya

    It seems that piece of code you inserted is not clean. Try to accurately remove exactly that part you inserted or restore function.php from the backup copy.
    I can send you working code, tested at my playground.

  • Dave

    i removed it already. thanks, that would be great if you could send me your working code to my email, because i tried also the one from your link:

    function published_to_pending($post_id) {
    global $post;

    if (!is_object($post)) {
    return;
    }

    if (current_user_can(‘author’) && $post->post_status==’publish’) {
    // stop recursion call
    remove_action(‘save_post’, ‘published_to_pending’);
    // update the post, which calls save_post again
    wp_update_post(array(‘ID’ => $post_id, ‘post_status’ => ‘pending’));
    // re-hook this function back
    add_action(‘save_post’, ‘published_to_pending’);
    }

    }
    add_action(‘save_post’, ‘published_to_pending’);

  • montecampo Ltd.

    Hello.
    We would like to use this plugin in our service.
    Can we use it on bussiness?

  • http://shinephp.com Vladimir Garagulya

    Hello,
    Yes, you are free in decision where and how to use this plugin. User Role Editor is licensed under GPL v.2 (http://www.gnu.org/licenses/gpl-2.0.html)

  • waqar

    Hello, I worked on your plugin before 1 year and restricted admin user to view all menus and that time there was some url to restore all menus for admin users. I have forgot it. Can you help me? I want admin to see all menus.

  • http://shinephp.com Vladimir Garagulya

    Hello,

    Do you mean this post?
    http://shinephp.com/how-to-change-wordpress-user-role-capabilities/

    If you lost full access to your site, you may make direct database edit replacing current roles with some from new setup test WP instance, where administrator will have full access to WP menu.

  • montecampo Ltd.

    thank you for your replay.

  • Raja Shio

    You do not have sufficient permissions to access this page.
    just appear like that

  • niloofar akefian

    when shopmanager role have edited, control panel will be hidden for him.why and what can i do?

  • http://shinephp.com Vladimir Garagulya

    Please send the link to plugin which defines shopmanager role and screenshot with changed shopmanager role.

  • http://shinephp.com Vladimir Garagulya

    It is a limitation of current version. I plan to add the separate field for role name (without so hard input control) in the next version of User Role Editor (May, 2013).

  • Simone Pescina

    Hi Vladimir.
    Is there a way to add new global roles in a multisite environment? I think I’m facing some problems working on this functionality…

  • http://shinephp.com Vladimir Garagulya

    Hi Simone.

    No. WordPress doesn’t manage global roles in a multisite environment. Every site has its own roles set. There is workaround. You may duplicate any role from your main site to the rest part of your network. Turn on ‘Apply to All Sites’ checkbox and click ‘Update’, this way selected role will be copied to the all sites of your network automatically.

  • Simone Pescina

    that works, but in my case isn’t the better solution. I’m using multisite for managing a multilanguage site and I would have user roles translated as well. But I don’t think this could be possible… any ideas?

  • Bart

    Hi, I want to thank you for this great plugin. I donated $10 to your account to express my thanks!
    Greets,
    Bart

  • http://shinephp.com Vladimir Garagulya

    Hi Bart,

    Thanks a lot for your support.

    Regards,
    Vladimir.

  • Bart

    You’re welcome Vladimir!

  • Nick

    Hi,

    I’d like to “add a capability” to “read_scheduled_posts”, but am not sure how to do this. Is this possible?

    Regards,
    Nick