public function Authmap::get in External Authentication 8
Same name and namespace in other branches
- 2.0.x src/Authmap.php \Drupal\externalauth\Authmap::get()
Get the external authname for a given user ID.
Parameters
int $uid: The Drupal user ID.
string $provider: The name of the service providing external authentication.
Return value
string|bool The external authname / ID, or FALSE.
Overrides AuthmapInterface::get
File
- src/
Authmap.php, line 59
Class
- Authmap
- Class Authmap.
Namespace
Drupal\externalauthCode
public function get($uid, $provider) {
$authname = $this->connection
->select('authmap', 'am')
->fields('am', [
'authname',
])
->condition('uid', $uid)
->condition('provider', $provider)
->range(0, 1)
->execute()
->fetchObject();
if ($authname) {
return $authname->authname;
}
return FALSE;
}