public static function getProviderByScheme($AuthenticationSchemeAlias, $UserID = null)
{
$ProviderQuery = Gdn::sql()->select('uap.*')->from('UserAuthenticationProvider uap')->where('uap.AuthenticationSchemeAlias', $AuthenticationSchemeAlias);
if (!is_null($UserID) && $UserID) {
$ProviderQuery->join('UserAuthentication ua', 'ua.ProviderKey = uap.AuthenticationKey', 'left')->where('ua.UserID', $UserID);
}
$ProviderData = $ProviderQuery->get();
if ($ProviderData->numRows()) {
$Result = $ProviderData->firstRow(DATASET_TYPE_ARRAY);
self::calculate($Result);
return $Result;
}
return false;
}