@nonprofitweb,
Thanks again for this new fix. I have just added it.
I will update it tomorrow.
You are the best tester we have ever had!
Update: While the above solution works in my particular use case, a more robust solution that checks against the editable roles is as follows:
// first get all roles
global $wp_roles;
$all_roles = $wp_roles->roles;
// now remove editable roles
$exclude_roles = array_diff(array_keys($all_roles), $editable_roles);
// make sure administrator role is still in array. This continues current method of excluding administrator role in $args
if ( !in_array('administrator', $exclude_roles )){
$exclude_roles[] = 'administrator';
}
$args = array(
'fields' => array( 'ID' ),
'role__not_in' => $exclude_roles,
'exclude' => array(get_current_user_id()),
);
Note that role__in can’t be used in the situation a user has multiple roles and at least one of the roles is not in the editable_roles list and at least one of the roles is in the editable_roles list. In this situation, the user would be removed even though they have a role that is not editable by the person performing the import.
Hope this is helpful.
-
This reply was modified 6 years ago by
nonprofitweb. Reason: Code inclusion didn't work right
You are great.
I have just made an upload with new version including this code and also the one to include classes in DOM.
You are the biggest contributor in years.