Your question seems to boil down to this
I can't figure out how to check that the $userids in question are an administrators user ID.
Try
if (user_can($id,'administrator'))
http://codex.wordpress.org/Function_Reference/user_can
The Codex has a warning about using role names with the current_user_can
function and it is very similar to user_can
so I suppose caution is order until the conflicting instructions are sorted.
Do not pass a role name to current_user_can(), as this is not guaranteed to work correctly.
The same page also says:
$capability
(string) (required) capability or role name
Default: None
- @param string $capability Capability or role name.
Are you hacking core file? The users.php
isn't this users.php
is it? That is a high maintenance path your are going down if it is.