WordPress.org

Ready to get started?Download WordPress

Forums

Admin Menu Editor
Add multiple user roles to menu item? (3 posts)

  1. Tech4Eleven
    Member
    Posted 1 year ago #

    In the Required capability field for any of the menu items, if I add Editor there, it doesn't allow the administrator to see it. Seems like it would take affect for that role and any others that are greater than it. I tried to type in 2 roles in the field, separated by a coma, but it doesnt work for the lesser role (example: "administrator, editor" doesnt allow the editor to see it, just the admin).

    CAN this work, having 2 roles in the field?

    http://wordpress.org/extend/plugins/admin-menu-editor/

  2. Janis Elsts
    Member
    Plugin Author

    Posted 1 year ago #

    No, in the free version, you can only have one capability or role in the field. In the Pro version, you can actually enter a comma-separated list, and it will work as you would expect (though there are easier ways to set role permissions in the Pro version).

    As to why adding Editor prevents Administrators from seeing the menu:

    While the default WP roles look like they form a clear hierarchy (i.e. Administrator is "greater" than Editor and so on), that's not actually the case in general. For example, it would be entirely possible to create a custom role that has some capabilities that only Administrators have, but lacks some of the capabilities of an Editor.

    Overall, there is no general and reliable way to determine if a given role is lesser on greater than another - except for the default roles, that is, where the relations could be hard-coded (and even that could fail if the user was to edit the default roles). So entering a role ID in the "required capability" field will restrict the menu to that specific role.

  3. Janis Elsts
    Member
    Plugin Author

    Posted 1 year ago #

    Addendum: To make a menu visible to two roles, set its "required capability" field to a capability that both of those roles have. For Administrator and Editor, that would be "moderate_comments", "edit_others_posts" or any other capability they share.

    See this table for the full list:
    http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.