Unsubscribes from a thread.
@param ModelInterface $thread
@return PodiumResponse
@throws NoMembershipException
967945
public function unsubscribeThread(ModelInterface $thread): PodiumResponse
    {
        return $this->getPodium()->thread->unsubscribe($this->ensureMembership(), $thread);
    }
350468
public function removeMember(PrincipalInterface $principal)
    {

        // query whether or not the passed principal is a member of this group
        if ($this->members->exists($principal->getName())) {
            // remove the princial and return TRUE
            $this->members->remove($principal->getName());
            return true;
        }

        // return FALSE, if not
        return false;
    }
883900
public function cancelSubscription($subscriptionId)
    {
        return $this->client->subscriptions->cancelFor($this, $subscriptionId, $this->getPresetOptions());
    }
781290
public function create(array $data, MembershipInterface $author, ModelInterface $thread): PodiumResponse
    {
        /* @var $pollForm CategorisedFormInterface */
        $pollForm = $this->getForm();

        $pollForm->setAuthor($author);
        $pollForm->setThread($thread);

        if (!$pollForm->loadData($data)) {
            return PodiumResponse::error();
        }

        return $pollForm->create();
    }
764110
public static function remove($threads = [])
    {
        try {
            if (!empty($threads)) {
                return Podium::getInstance()->db->createCommand()->delete(
                        Subscription::tableName(), ['id' => $threads, 'user_id' => User::loggedId()]
                    )->execute();
            }
        } catch (Exception $e) {
            Log::error($e->getMessage(), null, __METHOD__);
        }
        return false;
    }
875260
public function create(array $data, MembershipInterface $author, ModelInterface $thread): PodiumResponse
    {
        /* @var $postForm CategorisedFormInterface */
        $postForm = $this->getForm();

        $postForm->setAuthor($author);
        $postForm->setThread($thread);

        if (!$postForm->loadData($data)) {
            return PodiumResponse::error();
        }

        return $postForm->create();
    }
261501
public function remove(int $id): PodiumResponse
    {
        $groupRemover = $this->getRemover($id);

        if ($groupRemover === null) {
            throw new ModelNotFoundException('Group of given ID can not be found.');
        }

        return $groupRemover->remove();
    }
391228
public function befriendMember(MembershipInterface $target): PodiumResponse
    {
        return $this->getPodium()->member->befriend($this->ensureMembership(), $target);
    }
471695
public function unfriend(Model $recipient)
    {
        $deleted = $this->findFriendship($recipient)->delete();

        Event::fire('friendships.cancelled', [$this, $recipient]);

        return $deleted;
    }
1322232
static function updateThread($thread)
    {
        // Update the category thread and post counts
        $postCount = $thread->posts->where('deleted_at', null)->count();
        $thread->reply_count = $postCount - 1;
        $thread->saveWithoutTouch();
    }
1277433
public function join(MembershipInterface $member, ModelInterface $group): PodiumResponse
    {
        $grouping = $this->getGrouper();

        $grouping->setMember($member);
        $grouping->setGroup($group);

        return $grouping->join();
    }
160096
public function removeSubscriber(EventSubscriberInterface $subscriber)
    {
        unset($this->subscribers[array_search($subscriber, $this->subscribers, true)]);
        $this->subscribers = empty($this->subscribers) ? [] : array_values($this->subscribers);

        return $this;
    }
1057217
public function removeMessage(int $id): PodiumResponse
    {
        return $this->getPodium()->message->remove($id, $this->ensureMembership());
    }
161087
public function remove(Driver $driver, ModelInterface $model)
    {
        $this->managerFactory->setModelClass(get_class($model));
        $manager = $this->managerFactory->getManager($driver);
        $event = new FilterModelEvent();
        $event->setModel($model);
        $event->setManager($manager);
        $this->eventSubscriber->subscribe(Constants::PRE_DELETE, $event);

        /** @var JsonResponse $response */
        if ($response = $event->getResponse() instanceof JsonResponse) {
            $content = json_decode($response->getContent(), true);
            $this->errorMessage = isset($content['message']) ? $content['message'] : 'message.delete_failed';

            return false;
        }

        try {
            $manager->remove($model);
        } catch (\Exception $exception) {
            $this->errorMessage = 'message.delete_failed';

            return false;
        }

        return true;
    }
769671
public function leaveGroup(ModelInterface $group): PodiumResponse
    {
        return $this->getPodium()->member->leave($this->ensureMembership(), $group);
    }
934136
public function actionDelete($id = null)
    {
        $model = Subscription::find()->where(['id' => (int)$id, 'user_id' => User::loggedId()])->limit(1)->one();
        if (empty($model)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find Subscription with this ID.'));
            return $this->redirect(['profile/subscriptions']);
        }
        if ($model->delete()) {
            $this->module->podiumCache->deleteElement('user.subscriptions', User::loggedId());
            $this->success(Yii::t('podium/flash', 'Thread has been unsubscribed.'));
        } else {
            Log::error('Error while deleting subscription', $model->id, __METHOD__);
            $this->error(Yii::t('podium/flash', 'Sorry! There was some error while deleting the subscription.'));
        }
        return $this->redirect(['profile/subscriptions']);
    }
1285503
function remove_thread($mailbox = null)
    {
        $this->db->query(
            "DELETE FROM {$this->thread_table}"
            ." WHERE `user_id` = ?"
                .(strlen($mailbox) ? " AND `mailbox` = ".$this->db->quote($mailbox) : ""),
            $this->userid
        );

        if (strlen($mailbox)) {
            unset($this->icache[$mailbox]['thread']);
            // Thread data removed, set flag to skip SELECT query in get_thread()
            $this->icache[$mailbox]['thread_queried'] = true;
        }
        else {
            $this->icache = array();
        }
    }