本文整理匯總了PHP中sfGuardUser::setFacebookAuthCode方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfGuardUser::setFacebookAuthCode方法的具體用法?PHP sfGuardUser::setFacebookAuthCode怎麽用?PHP sfGuardUser::setFacebookAuthCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfGuardUser
的用法示例。
在下文中一共展示了sfGuardUser::setFacebookAuthCode方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: populateFromFacebook
public function populateFromFacebook($doSave = true)
{
$fb = $this->getFacebook();
if (!($sfGuardUser = $this->getGuardUser())) {
if ($email = $fb->getEmail()) {
//-- Emails must be uniqe so start there
$sfGuardUser = Doctrine::getTable('sfGuardUser')->findOneByEmailAddress($email);
}
if (!$sfGuardUser && ($fb_uid = $fb->getId())) {
$sfGuardUser = Doctrine::getTable('sfGuardUser')->findOneByFacebookUid($fb_uid);
}
if (!$sfGuardUser) {
$sfGuardUser = new sfGuardUser();
}
}
//-- If it is in the session but not the guard User, add it to the guard user
if (!$sfGuardUser->getFacebookAuthCode() && $this->getAttribute('facebook_auth_code')) {
if (sfConfig::get('sf_logging_enabled')) {
sfContext::getInstance()->getLogger()->info('--- DEBUG --- FB AUTH CODE in session but not the guard User');
}
$sfGuardUser->setFacebookAuthCode($this->getAttribute('facebook_auth_code'));
}
$sfGuardUser->populateWithFacebook($fb);
if ($doSave) {
$sfGuardUser->save();
$this->signin($sfGuardUser);
}
//-- NOTE: The $sfGuardUser MAY NOT be saved yet!
$dispatcher = sfContext::getInstance()->getEventDispatcher();
$dispatcher->notify(new sfEvent($sfGuardUser, 'm14tFacebook.connect', array()));
return $sfGuardUser;
}