/** * Signs user up. * @param boolean $runValidation whether to perform validation (calling [[validate()]]) * before signup the user. * @return User|null the saved model or null if saving fails */ public function signup($runValidation = true) { if ($runValidation && !$this->validate()) { return null; } $user = new User(); $user->email = $this->email; $user->password = $this->password; $user->statusId = User::STATUS_ACTIVE; if ($user->save(false)) { $user->sendNewUserEmail(); return $user; } return null; }