public function bdApiConsumer_updateExternalAuthAssociation(array $provider, $providerKey, $userId, array $extra) { $providerCode = $this->bdApiConsumer_getProviderCode($provider); if (!empty($extra['token']['expires_in']) and empty($extra['token']['expire_date'])) { // use time() instead of XenForo_Application::$time to avoid issues // when script is running for a long time in the background / CLI $extra['token']['expire_date'] = time() + $extra['token']['expires_in']; } if (!empty($extra['token']['_headers'])) { unset($extra['token']['_headers']); } if (!empty($extra['token']['_responseStatus'])) { unset($extra['token']['_responseStatus']); } if (bdApiConsumer_Option::get('takeOver', 'avatar')) { $avatarUrl = bdApiConsumer_Helper_Avatar::getAvatarUrlFromAuthExtra($extra); if (!empty($avatarUrl)) { $this->getModelFromCache('XenForo_Model_Avatar')->bdApiConsumer_applyAvatar($userId, $avatarUrl); } } if (XenForo_Application::$versionId >= 1030000) { return $this->updateExternalAuthAssociation($providerCode, $providerKey, $userId, $extra); } else { return $this->updateExternalAuthAssociation($providerCode, $providerKey, $userId, $this->bdApiConsumer_getUserProfileField(), $extra); } }
public function actionExternalAvatar() { $userId = $this->_input->filterSingle('user_id', XenForo_Input::UINT); $auths = $this->getModelFromCache('XenForo_Model_UserExternal')->bdApiConsumer_getExternalAuthAssociations($userId); foreach ($auths as $auth) { $avatarUrl = bdApiConsumer_Helper_Avatar::getAvatarUrlFromAuthExtra($auth['extra_data']); if (!empty($avatarUrl)) { return $this->responseRedirect(XenForo_ControllerResponse_Redirect::RESOURCE_CANONICAL, $avatarUrl); } } return $this->responseNoPermission(); }