backend/controllers/UsersController.php
/**
     * Changes user_status in an Users model/
     * @param string $id
     * @return mixed
     */
Changes user_status in an Users model
@param string $id
@return mixed
Changes user_status in an Users model @param string $id @return mixed
public function actionChangeStatus($id)
    {
        $model = $this->findModel($id);
        $model->user_status = $model->user_status == Users::STATUS_ACTIVE ? Users::STATUS_BLOCKED : Users::STATUS_ACTIVE;
        $model->save();
        if (Yii::$app->getRequest()->isAjax) {
            unset($_GET['id']);
            return $this->getIndexContent('renderPartial');
        }
        $qs = Yii::$app->request->get('qs');
        if ($qs) { $qs = "?".base64_decode($qs); } else { $qs = ""; }
        return $this->redirect(['index'.$qs]);
    }
public function actionChangeStatus ( $ id ) { $ model = $ this -> findModel ( $ id ) ; $ model -> user_status = $ model -> user_status == Users :: STATUS_ACTIVE ? Users :: STATUS_BLOCKED : Users :: STATUS_ACTIVE ; $ model -> save ( ) ; if ( Yii :: $ app -> getRequest ( ) -> isAjax ) { unset ( $ _GET [ 'id' ] ) ; return $ this -> getIndexContent ( 'renderPartial' ) ; } $ qs = Yii :: $ app -> request -> get ( 'qs' ) ; if ( $ qs ) { $ qs = " ? " . base64_decode ( $ qs ) ; } else { $ qs = " " ; } return $ this -> redirect ( [ 'index' . $ qs ] ) ; }
Changes user_status in an Users model
 @param string $id
 @return mixed
Changes user_status in an Users model @param string $id @return mixed