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