caseproof / members

Members WordPress plugin.
GNU General Public License v2.0
78 stars 35 forks source link

Allow the minimum 'view in admin' role of 'list_roles' to be filtered #102

Closed baden03 closed 1 year ago

baden03 commented 1 year ago

Just because a user can list_roles does not mean they need to have the Members menu item added to their admin. For example, if we want to allow a manager to promote an employee to become a manager they need the ability to list_roles but do not need to have the Members menu added to their admin interface.

usage:

// Only show members manager in admin to admins.
add_filter( 'members_min_show_admin_role', 'show_role_manager' );
function show_role_manager( $edit_roles_cap ){
    return 'edit_roles';
}
cartpauj commented 1 year ago

Thanks @baden03 - would you mind changing the hook name to members_show_roles_page_cap? Thanks!

baden03 commented 1 year ago

it would be my pleasure. "The device has been modified".