本文整理匯總了PHP中UserHelper::sendEmailConfirmation方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserHelper::sendEmailConfirmation方法的具體用法?PHP UserHelper::sendEmailConfirmation怎麽用?PHP UserHelper::sendEmailConfirmation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserHelper
的用法示例。
在下文中一共展示了UserHelper::sendEmailConfirmation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: register
public function register()
{
$user = new User();
$user->first_name = $this->first_name;
$user->last_name = $this->last_name;
$user->email = $this->email;
$user->position = $this->position;
$user->phone = $this->phone;
$user->password = $this->password;
$user->username = $this->username;
$user->role = User::ROLE_EMPL;
$user->status = User::STATUS_DISABLED;
$user->additional_contact = $this->additional_contact;
$user->hash = md5(microtime(true) . rand());
if (!$user->save()) {
$this->addError('username', 'Can`t create user ' . serialize($user->getErrors()));
return false;
}
UserHelper::sendEmailConfirmation($user);
$company = new Company();
$company->name = $this->name;
$company->site_url = $this->site_url;
$company->address = $this->address;
$company->created_at = new CDbExpression('NOW()');
$company->updated_at = new CDbExpression('NOW()');
if (!$company->save()) {
$this->addError('name', 'Can`t create company ' . serialize($company->getErrors()));
return false;
}
$bind = new UserToCompany();
$bind->user_id = $user->id;
$bind->company_id = $company->id;
if (!$bind->save()) {
$this->addError('name', 'Can`t bind company ' . serialize($bind->getErrors()));
return false;
}
return true;
}