WordPress.org

Support

Support » How-To and Troubleshooting » User Roles and Capabilities

User Roles and Capabilities

  • Josh
    Participant

    @josh401

    Hi,

    Here is the page I am using as reference:
    http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table

    I would like to offer an option in my plugin to allow users to choose which roles they would like to add a certain feature.

    I understand how to do this using the above page for reference, but here is where I get stuck:

    Let’s pretend the user wants to show the feature only to “administrator” and “author” roles. If I use something like if(current_user_can('edit_published_posts')){, for the author role… won’t it still be available for the “Editor” role also? Which was not selected by the user.

    So, my question… how would you only allow an “Admin” AND a “editor” to have access?

    The user levels are deprecated to my understanding (which seems like a good solution for my problem).

    Any suggestions?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘User Roles and Capabilities’ is closed to new replies.