public function actionDelete() { if (Yii::app()->user->isGuest) { throw new CHttpException(403, 'You are not authorized.'); } if (AgentProfileApi::deleteAgentProfile(Yii::app()->user->id)) { Yii::app()->user->setFlash('success', 'Your agent profile was removed successfully'); } else { Yii::app()->user->setFlash('error', 'Your agent profile could not be removed. Please contact the admin.'); } $this->redirect('/dashboard'); }