/** * * @param Gdn_Controller $Sender * @param array $Args */ public function profileController_jsConnect_create($Sender, $Args = array()) { include_once dirname(__FILE__) . '/functions.jsconnect.php'; $client_id = $Sender->Request->Get('client_id', 0); $Provider = self::getProvider($client_id); $client_id = GetValue('AuthenticationKey', $Provider); $Secret = GetValue('AssociationSecret', $Provider); if (Gdn::Session()->IsValid()) { $User = ArrayTranslate((array) Gdn::Session()->User, array('UserID' => 'UniqueID', 'Name', 'Email', 'PhotoUrl', 'DateOfBirth', 'Gender')); // Grab the user's roles. $Roles = Gdn::UserModel()->GetRoles(Gdn::Session()->UserID); $Roles = ConsolidateArrayValuesByKey($Roles, 'Name'); $User['Roles'] = ''; if (is_array($Roles) && sizeof($Roles)) { $User['Roles'] = implode(',', $Roles); } // $Sfx = 'F'; // $User['UniqueID'] .= $Sfx; // $User['Name'] .= $Sfx; // $User['Email'] = str_replace('@', '+'.$Sfx.'@', $User['Email']); if (!$User['PhotoUrl'] && function_exists('UserPhotoDefaultUrl')) { $User['PhotoUrl'] = Url(UserPhotoDefaultUrl(Gdn::Session()->User), TRUE); } } else { $User = array(); } ob_clean(); writeJsConnect($User, $Sender->Request->Get(), $client_id, $Secret, GetValue('HashType', $Provider, TRUE)); exit; }
/** * * * @param Gdn_Controller $Sender * @param array $Args */ public function profileController_jsConnect_create($Sender, $Args = array()) { include_once dirname(__FILE__) . '/functions.jsconnect.php'; $client_id = $Sender->Request->get('client_id', 0); $Provider = self::getProvider($client_id); $client_id = val('AuthenticationKey', $Provider); $Secret = val('AssociationSecret', $Provider); if (Gdn::session()->isValid()) { $User = ArrayTranslate((array) Gdn::session()->User, array('UserID' => 'UniqueID', 'Name', 'Email', 'PhotoUrl', 'DateOfBirth', 'Gender')); // Grab the user's roles. $Roles = Gdn::userModel()->getRoles(Gdn::session()->UserID); $Roles = array_column($Roles, 'Name'); $User['Roles'] = ''; if (is_array($Roles) && sizeof($Roles)) { $User['Roles'] = implode(',', $Roles); } if (!$User['PhotoUrl'] && function_exists('UserPhotoDefaultUrl')) { $User['PhotoUrl'] = Url(UserPhotoDefaultUrl(Gdn::session()->User), true); } } else { $User = []; } ob_clean(); writeJsConnect($User, $Sender->Request->get(), $client_id, $Secret, val('HashType', $Provider, true)); exit; }