I am trying to give a permission to user with role editor to create, edit and delete users, but would like to limit that so that they can not edit their roles. I have edited the capabilities of the user with the role editor like this:
function add_theme_caps() {
$role = get_role( 'editor' );
$role->add_cap( 'delete_users' );
$role->add_cap( 'create_users' );
$role->add_cap( 'add_users' );
$role->add_cap( 'list_users' );
}
add_action( 'admin_init', 'add_theme_caps');
But, I am not sure how can I remove the roles button when they are editing users?