controllers/RegistrationController.php
public function actionRegister()
	{
		$model = new User();
		$model->scenario = 'register';

		if ($model->load(Yii::$app->request->post()) && $model->register(FALSE, User::STATUS_PENDING)) {
			// Send Welcome Message to activate the account
			Mailer::sendWelcomeMessage($model);

			Yii::$app->session->setFlash(
				'success', Yii::t('user', 'You\'ve successfully been registered. Check your mail to activate your account'));

			return $this->redirect(Yii::$app->urlManager->createUrl('//user/auth/login'));
		}

		return $this->render('register', ['model' => $model]);
	}
public function actionRegister()
	{
		$model = new User();
		$model->scenario = 'register';

		if ($model->load(Yii::$app->request->post()) && $model->register(FALSE, User::STATUS_PENDING)) {
			// Send Welcome Message to activate the account
			Mailer::sendWelcomeMessage($model);

			Yii::$app->session->setFlash(
				'success', Yii::t('user', 'You\'ve successfully been registered. Check your mail to activate your account'));

			return $this->redirect(Yii::$app->urlManager->createUrl('//user/auth/login'));
		}

		return $this->render('register', ['model' => $model]);
	}
Register the user

@return string|\yii\web\Response