controllers/DefaultController.php
public function actionRegister()
    {
        if (!\Yii::$app->user->isGuest) {
            return $this->goHome();
        }

        $model = new RegisterForm();
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->session->setFlash("success", Yii::$app->user->isGuest
                ? Yii::t('modules/user', 'Please confirm registration email!')
                : Yii::t('modules/user', 'Registration completed!')
            );
            return (($url = $this->getLoginRedirect()) && !Yii::$app->user->isGuest)
                ? $this->redirect($url) 
                : $this->goBack();
        }
        return $this->render('register', compact('model'));
    }
public function actionRegister()
    {
        if (!\Yii::$app->user->isGuest) {
            return $this->goHome();
        }

        $model = new RegisterForm();
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->session->setFlash("success", Yii::$app->user->isGuest
                ? Yii::t('modules/user', 'Please confirm registration email!')
                : Yii::t('modules/user', 'Registration completed!')
            );
            return (($url = $this->getLoginRedirect()) && !Yii::$app->user->isGuest)
                ? $this->redirect($url) 
                : $this->goBack();
        }
        return $this->render('register', compact('model'));
    }
public function actionRegister ( ) { if ( ! \ Yii :: $ app -> user -> isGuest ) { return $ this -> goHome ( ) ; } $ model = new RegisterForm ( ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { Yii :: $ app -> session -> setFlash ( "success" , Yii :: $ app -> user -> isGuest ? Yii :: t ( 'modules/user' , 'Please confirm registration email!' ) : Yii :: t ( 'modules/user' , 'Registration completed!' ) ) ; return ( ( $ url = $ this -> getLoginRedirect ( ) ) && ! Yii :: $ app -> user -> isGuest ) ? $ this -> redirect ( $ url ) : $ this -> goBack ( ) ; } return $ this -> render ( 'register' , compact ( 'model' ) ) ; }
Registers user.
@return string view.
Registers user .