I need editors to be able to add/edit/delete other users. Giving them those capabilities is easy with code similar to this:
$editor = get_role('editor'); $editor->add_cap('edit_users');
The problem is that when they have the privileges they need to add/edit/delete other users, they can also do all of those things to admin users and/or promote themselves to the admin role.
Is there a way to allow them to add/edit/delete only specified user roles (best case scenario)? Or as an alternative, prevent editors from doing anything at all to admin accounts, and possibly even hide those accounts from their list view altogether?