public function actionIgnore($id = null)
    {
        if (Podium::getInstance()->user->isGuest) {
            return $this->redirect(['forum/index']);
        }

        $model = User::find()->where([
                'and',
                ['id' => (int)$id],
                ['!=', 'status', User::STATUS_REGISTERED]
            ])->limit(1)->one();
        if (empty($model)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find Member with this ID.'));
            return $this->redirect(['members/index']);
        }

        $logged = User::loggedId();

        if ($model->id == $logged) {
            $this->error(Yii::t('podium/flash', 'Sorry! You can not ignore your own account.'));
            return $this->redirect(['members/view', 'id' => $model->id, 'slug' => $model->podiumSlug]);
        }

        if ($model->id == User::ROLE_ADMIN) {
            $this->error(Yii::t('podium/flash', 'Sorry! You can not ignore Administrator.'));
            return $this->redirect(['members/view', 'id' => $model->id, 'slug' => $model->podiumSlug]);
        }

        if ($model->updateIgnore($logged)) {
            if ($model->isIgnoredBy($logged)) {
                $this->success(Yii::t('podium/flash', 'User is now ignored.'));
            } else {
                $this->success(Yii::t('podium/flash', 'User is not ignored anymore.'));
            }
        } else {
            $this->error(Yii::t('podium/flash', 'Sorry! There was some error while performing this action.'));
        }
        return $this->redirect(['members/view', 'id' => $model->id, 'slug' => $model->podiumSlug]);
    }
public function actionIgnore($id = null)
    {
        if (Podium::getInstance()->user->isGuest) {
            return $this->redirect(['forum/index']);
        }

        $model = User::find()->where([
                'and',
                ['id' => (int)$id],
                ['!=', 'status', User::STATUS_REGISTERED]
            ])->limit(1)->one();
        if (empty($model)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find Member with this ID.'));
            return $this->redirect(['members/index']);
        }

        $logged = User::loggedId();

        if ($model->id == $logged) {
            $this->error(Yii::t('podium/flash', 'Sorry! You can not ignore your own account.'));
            return $this->redirect(['members/view', 'id' => $model->id, 'slug' => $model->podiumSlug]);
        }

        if ($model->id == User::ROLE_ADMIN) {
            $this->error(Yii::t('podium/flash', 'Sorry! You can not ignore Administrator.'));
            return $this->redirect(['members/view', 'id' => $model->id, 'slug' => $model->podiumSlug]);
        }

        if ($model->updateIgnore($logged)) {
            if ($model->isIgnoredBy($logged)) {
                $this->success(Yii::t('podium/flash', 'User is now ignored.'));
            } else {
                $this->success(Yii::t('podium/flash', 'User is not ignored anymore.'));
            }
        } else {
            $this->error(Yii::t('podium/flash', 'Sorry! There was some error while performing this action.'));
        }
        return $this->redirect(['members/view', 'id' => $model->id, 'slug' => $model->podiumSlug]);
    }
public function actionIgnore ( $ id = null ) { if ( Podium :: getInstance ( ) -> user -> isGuest ) { return $ this -> redirect ( [ 'forum/index' ] ) ; } $ model = User :: find ( ) -> where ( [ 'and' , [ 'id' => ( int ) $ id ] , [ '!=' , 'status' , User :: STATUS_REGISTERED ] ] ) -> limit ( 1 ) -> one ( ) ; if ( empty ( $ model ) ) { $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! We can not find Member with this ID.' ) ) ; return $ this -> redirect ( [ 'members/index' ] ) ; } $ logged = User :: loggedId ( ) ; if ( $ model -> id == $ logged ) { $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! You can not ignore your own account.' ) ) ; return $ this -> redirect ( [ 'members/view' , 'id' => $ model -> id , 'slug' => $ model -> podiumSlug ] ) ; } if ( $ model -> id == User :: ROLE_ADMIN ) { $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! You can not ignore Administrator.' ) ) ; return $ this -> redirect ( [ 'members/view' , 'id' => $ model -> id , 'slug' => $ model -> podiumSlug ] ) ; } if ( $ model -> updateIgnore ( $ logged ) ) { if ( $ model -> isIgnoredBy ( $ logged ) ) { $ this -> success ( Yii :: t ( 'podium/flash' , 'User is now ignored.' ) ) ; } else { $ this -> success ( Yii :: t ( 'podium/flash' , 'User is not ignored anymore.' ) ) ; } } else { $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! There was some error while performing this action.' ) ) ; } return $ this -> redirect ( [ 'members/view' , 'id' => $ model -> id , 'slug' => $ model -> podiumSlug ] ) ; }
Ignoring the user of given ID.
@param int $id
@return Response
Ignoring the user of given ID .