当前位置: 首页>>代码示例>>PHP>>正文


PHP User::register方法代码示例

本文整理汇总了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'])]);
 }
开发者ID:keltstr,项目名称:yii2-podium,代码行数:29,代码来源:AccountController.php

示例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'])]);
 }
开发者ID:Avenger1,项目名称:yii2-podium,代码行数:38,代码来源:AccountController.php

示例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)]);
 }
开发者ID:pezisc,项目名称:yii2-podium,代码行数:32,代码来源:AccountController.php


注:本文中的bizley\podium\models\User::register方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。