public function actionDeleteposts($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_POST, ['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']);
        }

        $posts = Yii::$app->request->post('post');
        if ($posts) {
            if (!is_array($posts)) {
                $this->error(Yii::t('podium/flash', 'You have to select at least one post.'));
            } else {
                if ($thread->podiumDeletePosts($posts)) {
                    $this->success(Yii::t('podium/flash', 'Posts have been deleted.'));
                    if (Thread::find()->where(['id' => $thread->id])->exists()) {
                        return $this->redirect([
                            'forum/thread',
                            'cid' => $thread->forum->category->id,
                            'fid' => $thread->forum->id,
                            'id' => $thread->id,
                            'slug' => $thread->slug
                        ]);
                    }
                    return $this->redirect([
                        '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 posts.'));
            }
        }
        return $this->render('deleteposts', [
            'model' => $thread,
            'dataProvider' => (new Post())->search($thread->forum->id, $thread->id)
        ]);
    }