public function actionRegister($referrer_code = "") { Yii::$app->view->title = "Lifeguard - Register"; if ($referrer_code != "") { $isDisableReferrer = true; } else { $isDisableReferrer = false; } $model = new SignupForm(); $model->referrer = $referrer_code; if ($model->load(Yii::$app->request->post())) { $model->code = $this->random_string(5); $model->username = $model->email; $model->status = User::STATUS_WAITING; if ($user = $model->signup()) { //Gui mail active account. if ($model->sendEmailActiveAccount($user)) { Yii::$app->session->setFlash('success', 'Thank you for joining us! We have sent you an email to validate your account, please click on the link in your email to login.'); } else { Yii::$app->session->setFlash('error', 'Cannot send a email confirm your registration.'); } } else { Yii::$app->session->setFlash('error', 'The register is error.'); } } $states = Common::$states; return $this->render('register', ['model' => $model, 'states' => $states, 'isDisableReferrer' => $isDisableReferrer]); }