This works:
$WhoIsUser = get_users(
array(
'meta_key' => 'deviceid',
'meta_value' => '45545'
)
);
This returns the whole row for that user from the users table. If you print_r it out like so:
echo '<pre>'
echo print_r($WhoIsUser, TRUE);
echo '</pre>'
you get:
Array
(
[0] => WP_User Object
(
[data] => stdClass Object
(
[ID] => 123
[user_login] => userman
[user_pass] => $P$mBH8dpvhJD5xN8pk.
[user_nicename] => usermans
[user_email] => [email protected]
[user_url] =>
[user_registered] => 2020-05-11 14:36:24
[user_activation_key] => 157784:Fj8SR051xbzUVMpAFcYI0
[user_status] => 0
[display_name] => J B Gomez
)
[ID] => 123
[caps] => Array
(
[subscriber] => 1
)
and so on....
To access just the ID I wrote this:
$WhoIsUser[0]->ID;