Fetches a user object based on an external authentication source.
string $authname: The external authentication username.
A fully-loaded user object if the user is found or FALSE if not found.
function user_external_load($authname) {
$uid = db_query("SELECT uid FROM {authmap} WHERE authname = :authname", array(
':authname' => $authname,
))
->fetchField();
if ($uid) {
return user_load($uid);
}
else {
return FALSE;
}
}