User Roles and Capabilities (2 posts)

  1. Hi,

    Here is the page I am using as reference:

    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?

  2. vtxyzzy
    Posted 4 years ago #

    I think that the Members will let you define new capabilities and assign those only to specific roles.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.