public function actionVerifyUser($user_id) { $user = User::model()->findByPk($user_id); Yii::log($user->user_group_id, 'log'); if ($user->verify()) { Yii::app()->user->setFlash('success', $user->username . '\'s account is now verified.'); switch ($user->user_group_id) { case Student::USER_GROUP_ID: Emailer::emailStudentVerified($user); break; case Employer::USER_GROUP_ID: Emailer::emailEmployerVerified($user); break; } } else { Yii::app()->user->setFlash('error', $user->username . '\'s account could not be verified.'); } if (!Yii::app()->request->isAjaxRequest) { switch ($user->user_group_id) { case Student::USER_GROUP_ID: $this->redirect(array('verifyStudents')); case Employer::USER_GROUP_ID: $this->redirect(array('verifyEmployers')); default: $this->redirect(array('admin')); } } }