本文整理汇总了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;
}