本文整理匯總了PHP中sfGuardUser::setEmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfGuardUser::setEmail方法的具體用法?PHP sfGuardUser::setEmail怎麽用?PHP sfGuardUser::setEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfGuardUser
的用法示例。
在下文中一共展示了sfGuardUser::setEmail方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: executeRegister
/**
* executeRegister
*
* @access public
* @return void
*/
public function executeRegister(sfWebRequest $request)
{
$this->form = new sfGuardFormRegister();
if ($request->isMethod(sfRequest::POST)) {
$this->form->bind($request->getParameter($this->form->getName()));
if ($this->form->isValid()) {
$values = $this->form->getValues();
$sfGuardUser = new sfGuardUser();
$sfGuardUser->fromArray($values, BasePeer::TYPE_FIELDNAME);
if (isset($values['email'])) {
$sfGuardUser->setEmail($values['email']);
}
$sfGuardUser->setIsActive(false);
$sfGuardUser->save();
$messageParams = array('sfGuardUser' => $sfGuardUser, 'password' => $values['password']);
$body = $this->getComponent($this->getModuleName(), 'send_request_confirm', $messageParams);
$from = sfConfig::get('app_sf_guard_extra_plugin_mail_from', 'noreply@example.org');
$fromName = sfConfig::get('app_sf_guard_extra_plugin_name_from', 'noreply');
$to = $sfGuardUser->getEmail();
$toName = $sfGuardUser->getUsername();
$subject = sfConfig::get('app_sf_guard_extra_plugin_subject_confirm', 'Confirm Registration');
$mailer = $this->getMailer();
$message = $mailer->compose(array($from => $fromName), array($to => $toName), $subject, $body);
$mailer->send($message);
$this->getUser()->setFlash('values', $values);
$this->getUser()->setFlash('sfGuardUser', $sfGuardUser);
return $this->redirect('@sf_guard_do_register');
}
}
}