public function actionDelete()
    {
        if (!$this->module->enableAccountDelete) {
            throw new NotFoundHttpException(\Yii::t('user', 'Not found'));
        }

        /** @var User $user */
        $user  = \Yii::$app->user->identity;
        $event = $this->getUserEvent($user);

        \Yii::$app->user->logout();

        $this->trigger(self::EVENT_BEFORE_DELETE, $event);
        $user->delete();
        $this->trigger(self::EVENT_AFTER_DELETE, $event);

        \Yii::$app->session->setFlash('info', \Yii::t('user', 'Your account has been completely deleted'));

        return $this->goHome();
    }
public function actionDelete()
    {
        if (!$this->module->enableAccountDelete) {
            throw new NotFoundHttpException(\Yii::t('user', 'Not found'));
        }

        /** @var User $user */
        $user  = \Yii::$app->user->identity;
        $event = $this->getUserEvent($user);

        \Yii::$app->user->logout();

        $this->trigger(self::EVENT_BEFORE_DELETE, $event);
        $user->delete();
        $this->trigger(self::EVENT_AFTER_DELETE, $event);

        \Yii::$app->session->setFlash('info', \Yii::t('user', 'Your account has been completely deleted'));

        return $this->goHome();
    }
public function actionDelete ( ) { if ( ! $ this -> module -> enableAccountDelete ) { throw new NotFoundHttpException ( \ Yii :: t ( 'user' , 'Not found' ) ) ; } /** @var User $user */ $ user = \ Yii :: $ app -> user -> identity ; $ event = $ this -> getUserEvent ( $ user ) ; \ Yii :: $ app -> user -> logout ( ) ; $ this -> trigger ( self :: EVENT_BEFORE_DELETE , $ event ) ; $ user -> delete ( ) ; $ this -> trigger ( self :: EVENT_AFTER_DELETE , $ event ) ; \ Yii :: $ app -> session -> setFlash ( 'info' , \ Yii :: t ( 'user' , 'Your account has been completely deleted' ) ) ; return $ this -> goHome ( ) ; }
Completely deletes user's account.

@return \yii\web\Response
@throws \Exception
Completely deletes user s account .