本文整理汇总了PHP中bizley\podium\models\User::register方法的典型用法代码示例。如果您正苦于以下问题:PHP User::register方法的具体用法?PHP User::register怎么用?PHP User::register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bizley\podium\models\User
的用法示例。
在下文中一共展示了User::register方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionRegister
/**
* Registering the new account and sending the activation link.
* @return string|\yii\web\Response
*/
public function actionRegister()
{
$model = new User();
$model->setScenario('register');
if ($model->load(Yii::$app->request->post()) && $model->register()) {
$email = Content::find()->where(['name' => 'email-reg'])->one();
if ($email) {
$topic = $email->topic;
$content = $email->content;
} else {
$topic = Content::REG_TITLE;
$content = Content::REG_BODY;
}
$forum = Config::getInstance()->get('name');
if (Email::queue($model->email, str_replace('{forum}', $forum, $topic), str_replace('{forum}', $forum, str_replace('{link}', Html::a(Url::to(['account/activate', 'token' => $model->activation_token], true), Url::to(['account/activate', 'token' => $model->activation_token], true)), $content)), !empty($model->id) ? $model->id : null)) {
Log::info('Activation link queued', !empty($model->id) ? $model->id : '', __METHOD__);
$this->success('Your account has been created but it is not active yet. Click the activation link that has been sent to your e-mail address.');
} else {
Log::warning('Error while queuing activation link', !empty($model->id) ? $model->id : '', __METHOD__);
$this->warning('Your account has been created but it is not active yet. ' . 'Unfortunately there was some error while sending you the activation link. ' . 'Contact administrator about this or try to {link}resend the link{closelink}.', ['link' => Html::beginTag('a', ['href' => Url::to('account/reactivate')]), 'closelink' => Html::endTag('a')]);
}
return $this->module->goPodium();
}
return $this->render('register', ['model' => $model, 'terms' => Content::findOne(['name' => 'terms'])]);
}
示例2: actionRegister
/**
* Registering the new account and sending the activation link.
* @return string|\yii\web\Response
*/
public function actionRegister()
{
if (PodiumModule::getInstance()->userComponent == PodiumModule::USER_INHERIT) {
$this->info(Yii::t('podium/flash', 'Please use application Register form to sign up.'));
return $this->module->goPodium();
}
$model = new User();
$model->setScenario('register');
if ($model->load(Yii::$app->request->post()) && $model->register()) {
$email = Content::find()->where(['name' => 'email-reg'])->limit(1)->one();
if ($email) {
$topic = $email->topic;
$content = $email->content;
} else {
$topic = Messages::EMAIL_REG_TITLE;
$content = Messages::EMAIL_REG_BODY;
}
$forum = Config::getInstance()->get('name');
if (!empty($model->email)) {
if (Email::queue($model->email, str_replace('{forum}', $forum, $topic), str_replace('{forum}', $forum, str_replace('{link}', Html::a(Url::to(['account/activate', 'token' => $model->activation_token], true), Url::to(['account/activate', 'token' => $model->activation_token], true)), $content)), !empty($model->id) ? $model->id : null)) {
Log::info('Activation link queued', !empty($model->id) ? $model->id : '', __METHOD__);
$this->success(Yii::t('podium/flash', 'Your account has been created but it is not active yet. Click the activation link that has been sent to your e-mail address.'));
} else {
Log::warning('Error while queuing activation link', !empty($model->id) ? $model->id : '', __METHOD__);
$this->warning(Yii::t('podium/flash', 'Your account has been created but it is not active yet. ' . 'Unfortunately there was some error while sending you the activation link. ' . 'Contact administrator about this or try to {resend the link}.', ['resend the link' => Html::a(Yii::t('podium/flash', 'resend the link'), ['account/reactivate'])]));
}
} else {
Log::error('Error while queuing activation link - no email set', $model->id, __METHOD__);
$this->error(Yii::t('podium/flash', 'Sorry! There is no e-mail address saved with your account. Contact administrator about activating.'));
}
return $this->module->goPodium();
}
return $this->render('register', ['model' => $model, 'terms' => Content::findOne(['name' => 'terms'])]);
}
示例3: actionRegister
/**
* Registering the new account and sending the activation link.
* @return string|\yii\web\Response
*/
public function actionRegister()
{
if (PodiumModule::getInstance()->userComponent == PodiumModule::USER_INHERIT) {
$this->info(Yii::t('podium/flash', 'Please use application Register form to sign up.'));
return $this->module->goPodium();
}
$model = new User();
$model->scenario = 'register';
if ($model->load(Yii::$app->request->post()) && $model->register()) {
if (!empty($model->email)) {
$forum = Config::getInstance()->get('name');
$email = Content::fill(Content::EMAIL_REGISTRATION);
if ($email !== false && Email::queue($model->email, str_replace('{forum}', $forum, $email->topic), str_replace('{forum}', $forum, str_replace('{link}', Html::a(Url::to(['account/activate', 'token' => $model->activation_token], true), Url::to(['account/activate', 'token' => $model->activation_token], true)), $email->content)), !empty($model->id) ? $model->id : null)) {
Log::info('Activation link queued', !empty($model->id) ? $model->id : '', __METHOD__);
$this->success(Yii::t('podium/flash', 'Your account has been created but it is not active yet. Click the activation link that will be sent to your e-mail address in few minutes.'));
} else {
Log::warning('Error while queuing activation link', !empty($model->id) ? $model->id : '', __METHOD__);
$this->warning(Yii::t('podium/flash', 'Your account has been created but it is not active yet. Unfortunately there was some error while sending you the activation link. Contact administrator about this or try to {resend the link}.', ['resend the link' => Html::a(Yii::t('podium/flash', 'resend the link'), ['account/reactivate'])]));
}
} else {
Log::error('Error while queuing activation link - no email set', $model->id, __METHOD__);
$this->error(Yii::t('podium/flash', 'Sorry! There is no e-mail address saved with your account. Contact administrator about activating.'));
}
return $this->module->goPodium();
}
$model->captcha = null;
return $this->render('register', ['model' => $model, 'terms' => Content::fill(Content::TERMS_AND_CONDS)]);
}