Deleting the posts of given category ID, forum ID, thread 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
770189
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)
        ]);
    }
64468
public function delete($indexName, $type, $id)
	{
		$index = $this->elasticSearcher->indicesManager()->getRegistered($indexName);

		$params = [
			'index' => $index->getInternalName(),
			'type'  => $type,
			'id'    => $id
		];

		return $this->elasticSearcher->getClient()->delete($params);
	}
1321031
public function actionPost($cid = null, $fid = null, $tid = null, $pid = null)
    {
        $thread = Thread::find()->where([
                'id' => $tid,
                'category_id' => $cid,
                'forum_id' => $fid
            ])->limit(1)->one();
        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 ($thread->locked == 1 && !User::can(Rbac::PERM_UPDATE_THREAD, ['item' => $thread])) {
            $this->info(Yii::t('podium/flash', 'This thread is locked.'));
            return $this->redirect([
                'forum/thread',
                'cid' => $thread->forum->category->id,
                'fid' => $thread->forum->id,
                'id' => $thread->id,
                'slug' => $thread->slug
            ]);
        }

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

        $model = new Post();
        $model->subscribe = 1;
        $postData = Yii::$app->request->post();
        $replyFor = null;
        if (is_numeric($pid) && $pid > 0) {
            $replyFor = Post::find()->where(['id' => $pid])->limit(1)->one();
            if ($replyFor) {
                $model->content = Helper::prepareQuote($replyFor, Yii::$app->request->post('quote'));
            }
        }

        $preview = false;
        $previous = Post::find()->where(['thread_id' => $thread->id])->orderBy(['id' => SORT_DESC])->limit(1)->one();
        if ($model->load($postData)) {
            $model->thread_id = $thread->id;
            $model->forum_id = $thread->forum->id;
            $model->author_id = User::loggedId();
            if ($model->validate()) {
                if (isset($postData['preview-button'])) {
                    $preview = true;
                } else {
                    if ($model->podiumNew($previous)) {
                        $this->success(Yii::t('podium/flash', 'New reply has been added.'));
                        if (!empty($previous) && $previous->author_id == User::loggedId() && $this->module->podiumConfig->get('merge_posts')) {
                            return $this->redirect(['forum/show', 'id' => $previous->id]);
                        }
                        return $this->redirect(['forum/show', 'id' => $model->id]);
                    }
                    $this->error(Yii::t('podium/flash', 'Sorry! There was an error while adding the reply. Contact administrator about this problem.'));
                }
            }
        }
        return $this->render('post', [
            'replyFor' => $replyFor,
            'preview' => $preview,
            'model' => $model,
            'thread' => $thread,
            'previous' => $previous,
        ]);
    }
151285
public function entry($slug, $id)
    {
        // AUTHORIZE ... COMES HERE
        $form = $this->form->getBySlug($slug);
        $entry = $this->formEntry->getById($id);
        return view('chuckcms::backend.forms.entries.index', compact('form', 'entry'));
    }
267144
public function delete($fid) {
        $volume = $this->lookup($fid);

        if (!$volume) {
            throw new SeaweedFSException('Unable to find volume for ' . $fid);
        }

        $res = $this->client->delete($this->buildVolumeUrl($volume->getUrl(), $fid));

        if ($res->getStatusCode() != 202) {
            throw new SeaweedFSException('Unexpected response when deleting file: ' . $res->getStatusCode());
        }

        if ($this->cache && $this->cache->has('file_meta_' . $fid)) {
            $this->cache->remove('file_meta_' . $fid);
        }

        return true;
    }
1108039
public function getInfoPost($tid, $fid)
    {
        Container::get('hooks')->fire('model.post.get_info_post_start', $tid, $fid);

        $cur_posting['where'] = '(fp.read_forum IS NULL OR fp.read_forum=1)';
//            array(
//            array('fp.read_forum' => 'IS NULL'),
//            array('fp.read_forum' => '1')
//        );

        if ($tid) {
            $cur_posting['select'] = ['f.id', 'f.forum_name', 'f.moderators', 'f.redirect_url',
                'fp.post_replies', 'fp.post_topics', 't.subject', 't.closed', 'is_subscribed' => 's.user_id'];

            $cur_posting = DB::forTable('topics')
                            ->table_alias('t')
                            ->select_many($cur_posting['select'])
                            ->inner_join(DB::prefix().'forums', ['f.id', '=', 't.forum_id'], 'f')
//                            ->left_outer_join('forum_perms', array('fp.forum_id', '=', 'f.id'), 'fp')
//                            ->left_outer_join('forum_perms', array('fp.group_id', '=',
// User::get()->g_id), null, true)
                ->left_outer_join(
                    DB::prefix().'forum_perms',
                    '(fp.forum_id=f.id AND fp.group_id='. User::get()->g_id.')',
                    'fp'
                )
//                            ->left_outer_join('topic_subscriptions', array('t.id', '=', 's.topic_id'), 's')
//                            ->left_outer_join('topic_subscriptions', array('s.user_id', '=',
// User::get()->id), null, true)
                ->left_outer_join(
                    DB::prefix().'topic_subscriptions',
                    '(t.id=s.topic_id AND s.user_id='.User::get()->id.')',
                    's'
                )
                            ->where_raw($cur_posting['where'])
                            ->where('t.id', $tid);
        } else {
            $cur_posting['select'] = ['f.id', 'f.forum_name', 'f.moderators', 'f.redirect_url',
                'fp.post_replies', 'fp.post_topics'];

            $cur_posting = DB::forTable('forums')
                            ->table_alias('f')
                            ->select_many($cur_posting['select'])
//                            ->left_outer_join('forum_perms', array('fp.forum_id', '=', 'f.id'), 'fp')
//                            ->left_outer_join('forum_perms', array('fp.group_id', '=', User::get()->g_id), null, true)
                ->left_outer_join(
                    DB::prefix().'forum_perms',
                    '(fp.forum_id=f.id AND fp.group_id='. User::get()->g_id.')',
                    'fp'
                )
                            ->where_raw($cur_posting['where'])
                            ->where('f.id', $fid);
        }

        $cur_posting = Container::get('hooks')->fireDB('model.post.get_info_post_query', $cur_posting);
        $cur_posting = $cur_posting->find_one();

        if (!$cur_posting) {
            throw new  RunBBException(__('Bad request'), 404);
        }

        $cur_posting = Container::get('hooks')->fire('model.post.get_info_post', $cur_posting);

        return $cur_posting;
    }
58749
public function my_removeUid($uid)
    {
        if (get_instance()->isCluster()) {
            $this->map[$this->node_name]->remove($uid);
            foreach ($this->client as $client) {
                $client->removeNodeUid($this->node_name, $uid);
            }
            if (Start::isLeader()) {
                get_instance()->pub('$SYS/uidcount', $this->countOnline());
            }
        }
        $this->my_clearUidSub($uid);
    }
1326076
def delete_post(request, post_id, topic_id):
    
    try:
        topic = Topic.objects.get(id=topic_id)
        post = Post.objects.get(id=post_id)
    except:
        messages.error(request, 'Sorry, but this post can not be found. It may have been deleted already.')
        raise Http404
    return_url = "/forum/%s/%s/%s/" % (topic.forum.slug, topic.slug, topic_id)
    if request.user.is_authenticated() and (request.user.is_staff or request.user.id == post.author.id):
        post.delete()
        update_post_relations(request.user, topic, deleting=True)
        topic_posts = topic.post_set.count()
        pmax = (topic_posts / PAGINATE_BY) + 1

        # if no posts are left, delete topic.
        if topic_posts == 0:
            topic.delete()
            return HttpResponseRedirect("/forum/%s/" % topic.forum.slug)

        return HttpResponseRedirect("%spage%s/" % (return_url, pmax))
    else:
        raise Http404
557238
public function deleteById($id) {
		$this->provider('cache')->cacheClear('db', $this->getDao()->getTableName());
	    $obj = $this->getConnection()->where($this->getDao()->getTableId(), $id);
        return $obj->delete($this->getDao()->getTableName());
	}
670429
public static function deleteTaxId($id, $taxIdId, $params = null, $opts = null)
    {
        return self::_deleteNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts);
    }
146181
public function actionForum($cid = null, $id = null, $slug = null, $toggle = null)
    {
        $filters = Yii::$app->session->get('forum-filters');
        if (in_array(strtolower($toggle), ['new', 'edit', 'hot', 'pin', 'lock', 'all'])) {
            if (strtolower($toggle) == 'all') {
                $filters = null;
            } else {
                $filters[strtolower($toggle)] = empty($filters[strtolower($toggle)]) || $filters[strtolower($toggle)] == 0 ? 1 : 0;
            }
            Yii::$app->session->set('forum-filters', $filters);
            return $this->redirect([
                'forum/forum',
                'cid' => $cid,
                'id' => $id,
                'slug' => $slug
            ]);
        }

        $forum = Forum::verify($cid, $id, $slug, $this->module->user->isGuest);
        if (empty($forum)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the forum you are looking for.'));
            return $this->redirect(['forum/index']);
        }

        $this->setMetaTags(
            $forum->keywords ?: $forum->category->keywords,
            $forum->description ?: $forum->category->description
        );

        return $this->render('forum', [
            'model' => $forum,
            'filters' => $filters
        ]);
    }
362967
public static function deleteGroupAndContent($nids, $posts, &$context) {
    $results = [];
    // Load each node and delete it.
    foreach ($nids as $nid) {
      $node = Node::load($nid);
      $message = t('Delete @type "@title"', ['@type' => $node->getType(), '@title' => $node->getTitle()]);
      $results[] = $node->delete();
    }
    // Load each post and delete it.
    foreach ($posts as $post_id) {
      $post = Post::load($post_id);
      $message = t("Deleting @type\'s", ['@type' => $post->bundle()]);
      $results[] = $post->delete();
    }
    $context['message'] = $message;
    $context['results'] = $results;
  }
1309890
public function actionDelete($slug, $id)
    {
        $current_model = $this->module->getModel($slug);

        if(($current_model = $current_model::findOne($id))){
            $current_model->delete();
        } else {
            $this->error =  Yii::t('easyii', 'Not found');
        }
        return $this->formatResponse(Yii::t('gr', 'Post deleted'));
    }
325653
public function characteristicDataReadItem($pid, $cid) {
    $query = $this->connection->select('site_commerce_characteristics_data', 'n');
    $query->fields('n');
    $query->condition('n.cid', $cid);
    $query->condition('n.pid', $pid);

    return $query->execute()->fetchObject();
  }
364886
public function actionThread($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']);
        }

        $this->setMetaTags(
            $thread->forum->keywords ?: $thread->forum->category->keywords,
            $thread->forum->description ?: $thread->forum->category->description
        );

        $model = new Post;
        $model->subscribe = 1;
        $dataProvider = $model->search($thread->forum->id, $thread->id);

        return $this->render('thread', [
            'model' => $model,
            'dataProvider' => $dataProvider,
            'thread' => $thread,
        ]);
    }
1286073
public function deleteById($id)
    {
        $read = NotificationsStackRead::where([
                    'stack_id' => $id,
                    'user_id'  => user()->id
                ])->first();
        if (!is_null($read)) {
            return $read->delete();
        }
        return false;
    }
512314
function unfollow_by_id( $uid )
	{
		$params = array();
		$this->id_format($uid);
		$params['uid'] = $uid;
		return $this->oauth->post( 'friendships/destroy', $params);
	}