public function actionDelete($cid = null, $fid = null, $id = null, $slug = null)
    {
        $thread = (new ThreadVerifier([
            'categoryId' => $cid,
            'forumId' => $fid,
            'threadId' => $id,
            'threadSlug' => $slug
        ]))->verify();
        if (empty($thread)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the thread you are looking for.'));
            return $this->redirect(['forum/index']);
        }

        if (!User::can(Rbac::PERM_DELETE_THREAD, ['item' => $thread])) {
            $this->error(Yii::t('podium/flash', 'Sorry! You do not have the required permission to perform this action.'));
            return $this->redirect(['forum/index']);
        }

        $postData = Yii::$app->request->post('thread');
        if ($postData) {
            if ($postData != $thread->id) {
                $this->error(Yii::t('podium/flash', 'Sorry! There was an error while deleting the thread.'));
            } else {
                if ($thread->podiumDelete()) {
                    $this->success(Yii::t('podium/flash', 'Thread has been deleted.'));
                    return $this->redirect([
                        'forum/forum',
                        'cid' => $thread->forum->category_id,
                        'id' => $thread->forum->id,
                        'slug' => $thread->forum->slug
                    ]);
                }
                $this->error(Yii::t('podium/flash', 'Sorry! There was an error while deleting the thread.'));
            }
        }
        return $this->render('delete', ['model' => $thread]);
    }
public function actionDelete($cid = null, $fid = null, $id = null, $slug = null)
    {
        $thread = (new ThreadVerifier([
            'categoryId' => $cid,
            'forumId' => $fid,
            'threadId' => $id,
            'threadSlug' => $slug
        ]))->verify();
        if (empty($thread)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the thread you are looking for.'));
            return $this->redirect(['forum/index']);
        }

        if (!User::can(Rbac::PERM_DELETE_THREAD, ['item' => $thread])) {
            $this->error(Yii::t('podium/flash', 'Sorry! You do not have the required permission to perform this action.'));
            return $this->redirect(['forum/index']);
        }

        $postData = Yii::$app->request->post('thread');
        if ($postData) {
            if ($postData != $thread->id) {
                $this->error(Yii::t('podium/flash', 'Sorry! There was an error while deleting the thread.'));
            } else {
                if ($thread->podiumDelete()) {
                    $this->success(Yii::t('podium/flash', 'Thread has been deleted.'));
                    return $this->redirect([
                        'forum/forum',
                        'cid' => $thread->forum->category_id,
                        'id' => $thread->forum->id,
                        'slug' => $thread->forum->slug
                    ]);
                }
                $this->error(Yii::t('podium/flash', 'Sorry! There was an error while deleting the thread.'));
            }
        }
        return $this->render('delete', ['model' => $thread]);
    }
public function actionDelete ( $ cid = null , $ fid = null , $ id = null , $ slug = null ) { $ thread = ( new ThreadVerifier ( [ 'categoryId' => $ cid , 'forumId' => $ fid , 'threadId' => $ id , 'threadSlug' => $ slug ] ) ) -> verify ( ) ; if ( empty ( $ thread ) ) { $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! We can not find the thread you are looking for.' ) ) ; return $ this -> redirect ( [ 'forum/index' ] ) ; } if ( ! User :: can ( Rbac :: PERM_DELETE_THREAD , [ 'item' => $ thread ] ) ) { $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! You do not have the required permission to perform this action.' ) ) ; return $ this -> redirect ( [ 'forum/index' ] ) ; } $ postData = Yii :: $ app -> request -> post ( 'thread' ) ; if ( $ postData ) { if ( $ postData != $ thread -> id ) { $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! There was an error while deleting the thread.' ) ) ; } else { if ( $ thread -> podiumDelete ( ) ) { $ this -> success ( Yii :: t ( 'podium/flash' , 'Thread has been deleted.' ) ) ; return $ this -> redirect ( [ 'forum/forum' , 'cid' => $ thread -> forum -> category_id , 'id' => $ thread -> forum -> id , 'slug' => $ thread -> forum -> slug ] ) ; } $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! There was an error while deleting the thread.' ) ) ; } } return $ this -> render ( 'delete' , [ 'model' => $ thread ] ) ; }
Deleting the thread of given category ID, forum ID, own ID and slug.
@param int $cid category ID
@param int $fid forum ID
@param int $id thread ID
@param string $slug thread slug
@return string|Response
Deleting the thread of given category ID forum ID own ID and slug .