本文整理汇总了PHP中Model_User::getEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::getEmail方法的具体用法?PHP Model_User::getEmail怎么用?PHP Model_User::getEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_User
的用法示例。
在下文中一共展示了Model_User::getEmail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerAction
public function registerAction()
{
$request = $this->getRequest();
$form = new Form_User_Registration();
if ($request->isPost()) {
if ($form->isValid($request->getPost())) {
$model = new Model_User($form->getValues());
$user_id = $model->save();
$model->setId($user_id);
$globalSession = Zend_Registry::get('dlo.session');
$globalSession->user = $model;
//Zend_Loader::loadClass('Zend_View');
$view = new Zend_View();
$view->activationLink = "http://DrivingLessonOnline.com/user/verify-email/id/" . $model->getId() . "/guid/" . hash('sha1', $model->getSalt() . $model->getId() . $model->getPassword()) . "/";
$view->setBasePath(APPLICATION_PATH . "/views/");
$mailBodyHtml = $view->render('Templates/Account-Activation-Email.phtml');
//send email verification email before user can start using their account.
$mail = new Zend_Mail();
$mail->setBodyHtml($mailBodyHtml);
$mail->setFrom('no.reply@DrivingLessonOnline.com', 'Registration');
$mail->addTo($model->getEmail(), $model->getDisplayName());
$mail->setSubject($model->getDisplayName() . ' activiate your account for Driving Lesson Online.com');
$mail->send();
//thank user and inform to check their email to enable their account.
$this->_redirect('/user/registered');
}
}
$this->view->form = $form;
}
示例2: save
/**
*
* @param Model_User $user
* @return int The primary key of the row inserted. OR The number of rows updated.
*/
public function save(Model_User $user)
{
$data = array('email' => $user->getEmail(), 'password' => $user->getPassword(), 'firstname' => $user->getFirstName(), 'lastname' => $user->getLastName(), 'role' => $user->getRole(), 'date_modified' => time(), 'email_verified' => $user->getEmailVerified(), 'enabled' => $user->getEnabled(), 'last_login' => $user->getLastLogin(), 'salt' => $user->getSalt());
if (null === ($id = $user->getId())) {
unset($data['id']);
$data['password'] = hash('ripemd160', $data['password']);
$user->setPassword($data['password']);
$data['date_created'] = time();
return $this->getDbTable()->insert($data);
} else {
return $this->getDbTable()->update($data, array('id = ?' => $id));
}
}
示例3: registerprocessAction
public function registerprocessAction()
{
$request = $this->getRequest();
// Check if we have a POST request
if (!$request->isPost()) {
return $this->_helper->redirector('register');
}
// Get our form and validate it
$form = $this->getRegisterForm();
if (!$form->isValid($request->getPost())) {
// Invalid entries
$this->view->form = $form;
$this->getLog()->warn("Registration attempt failed");
return $this->render('register');
// re-render the login form
}
$values = $form->getValues();
// generate user uri
$fullname = $values['firstname'] . " " . $values['lastname'];
$uri = $this->getLA()->getUriForTitle($fullname, LOOMP::User());
$activationkey = md5(microtime() . $uri);
// create user account in db
$user = new Model_User();
$user->setEmail($values['mail'])->setPassword($values['password'])->setActivation($activationkey)->setActive(false)->setUserlevel(Model_User::USER_LEVEL_USER)->setUri($uri)->setFirstname($values['firstname'])->setLastname($values['lastname'])->setOrganisation($values['organisation']);
if (!$user->save()) {
$this->getLog()->err("Registration for {$user} failed - " . $user->ErrorMsg());
return $this->render('register');
}
$this->getLog()->info("Registration for {$user} succeeded");
$server_config = Zend_Registry::getInstance()->configuration->server;
$activation_link = LOOMP_BASE_PATH . $this->view->url(array('controller' => 'login', 'action' => 'activate'), 'default', true) . "?key=" . $activationkey;
// send e-mail to user
$mail = new Zend_Mail('UTF-8');
$mail->setBodyHTML("Welcome to LOOMP!\n <a href='{$activation_link}'>Activate your account by clicking here</a>.");
$mail->setFrom('loomp@' . $server_config->host, 'LOOMP Registration');
$mail->addTo($user->getEmail(), $user->getFullname());
$mail->setSubject("Account Activation for " . $user->getFullname());
$mail->send();
$this->getLog()->info("Registration mail sent to " . $user->getEmail());
// display thanks page
$this->view->mail = $user->getEmail();
// do nothing, thank you page will be rendered
}
示例4: sendForgotPassToken
/**
* @param Model_User $user
* @param $token
* @return bool
*/
public function sendForgotPassToken(Model_User $user, &$token)
{
$this->setEmailOptions("change_password");
$template = self::SEND_FORGOT_PASS_TOKEN;
$this->addTo($user->getEmail());
$token = NL_Crypt::Encrypt(array("id" => $user->getId()));
$this->assign("user", $user);
$this->assign("token", $token);
return $this->sendHtmlTemplate($template, Zend_Mime::ENCODING_8BIT);
}