Decreases the member's post count after a post deletion.

    This receiver handles the deletion of a forum post: the posts count related to the post's
    author is decreased.
434686
def decrease_posts_count_after_post_deletion(sender, instance, **kwargs):
    
    if not instance.approved:
        # If a post has not been approved, it has not been counted.
        # So do not decrement count
        return

    try:
        assert instance.poster_id is not None
        poster = User.objects.get(pk=instance.poster_id)
    except AssertionError:
        # An anonymous post is considered. No profile can be updated in
        # that case.
        return
    except ObjectDoesNotExist:  # pragma: no cover
        # This can happen if a User instance is deleted. In that case the
        # User instance is not available and the receiver should return.
        return

    profile, dummy = ForumProfile.objects.get_or_create(user=poster)
    if profile.posts_count:
        profile.posts_count = F('posts_count') - 1
        profile.save()
694061
public function deleteAction()
    {
        if ($this->isConfirmedItem($this->_('Delete %s'))) {
            $model   = $this->getModel();
            $deleted = $model->delete();

            $this->addMessage(sprintf($this->_('%2$u %1$s deleted'), $this->getTopic($deleted), $deleted), 'success');
            $this->_reroute(array('action' => 'index'), true);
        }
    }
654700
public function removePost(ForumThreadPost $post)
    {
        if ($this->posts->contains($post) === true) {
            $post->setThread(null);
            $this->posts->removeElement($post);
        }

        return $this;
    }
727709
private void postDelete(UserProfile userProfile) throws Exception
   {
      for (UserProfileEventListener listener : listeners)
      {
         listener.postDelete(userProfile);
      }
   }
179651
protected void handlePostEvent()
    {
        EntityMetadata metadata = getEntityMetadata();
        if (!kunderaQuery.isDeleteUpdate())
        {
            persistenceDelegeator.getEventDispatcher().fireEventListeners(metadata, null, PostLoad.class);
        }
    }
209178
public function afterDelete()
	{
		if (parent::beforeDelete()) {
			Comment::deleteAll('comment_id='.$this->id.' AND comment_table="'.self::MODULE_BLOG.'"');
			Tag::updateFrequency($this->tags, '');
		} else {
			return false;
		}
	}
429960
def participants(exclude_email=nil)
      ps = []
      self.posts.each do |p|
        if p.author_name && p.author_email
          ps << [p.author_name, p.author_email]
        end
      end
      ps.delete_if{|p| p[1] == exclude_email}.uniq
    end
1371987
public function afterDelete()
    {
        parent::afterDelete(); // TODO: Change the autogenerated stub
        $file = $this->getPath();
        $thumb = $this->getPath($this->thumb);
        @unlink($file);
        @unlink($thumb);
    }
931392
public function delete(Post $post)
    {
        $response = $this->api->process(new DeletePost($post));
        if ($response->getStatusCode() == 200) {
            return true;
        } else {
            return false;
        }
    }
94030
public function postDelete()
    {
        // If model is softDelete
        if (isset($this->isSoftDelete) and $this->isSoftDelete) {
            $revisions[] = array(
                'revisionable_type' => get_class($this),
                'revisionable_id' => $this->getKey(),
                'attribute' => 'deleted_at',
                'old_value' => null,
                'new_value' => $this->deleted_at,
                'user_id' => $this->getUserId(),
                'created_at' => new \DateTime(),
                'updated_at' => new \DateTime(),
            );
            $revision = new Revision;
            \DB::table($revision->getTable())->insert($revisions);
        } else {
            // Delete all associated revisions
            $this->revisions()->delete();
        }
    }
236448
@Override
    public void eventPostCommitRemove(Transaction transaction) throws SevereMessageStoreException
    {
        super.eventPostCommitRemove(transaction);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "eventPostCommitRemove", transaction);

        if (failedInitInRestore)
        {
            initialiseNonPersistent(true);
        }

        dereferenceControlAdapter();

        try
        {
            // TODO I'm curious why we have five slots here as there should only ever be three things registered
            // (the ConsumerDispatcher, PtoPMessageItemStream (or SubscriptionItemStream) and optionally a
            // JSLocalConsumerPoint).
            if (POST_COMMIT_REMOVE_5 != null)
            {
                POST_COMMIT_REMOVE_5.messageEventOccurred(MessageEvents.POST_COMMIT_REMOVE, this, transaction);
            }
            if (POST_COMMIT_REMOVE_4 != null)
            {
                POST_COMMIT_REMOVE_4.messageEventOccurred(MessageEvents.POST_COMMIT_REMOVE, this, transaction);
            }
            if (POST_COMMIT_REMOVE_3 != null)
            {
                POST_COMMIT_REMOVE_3.messageEventOccurred(MessageEvents.POST_COMMIT_REMOVE, this, transaction);
            }
            if (POST_COMMIT_REMOVE_2 != null)
            {
                POST_COMMIT_REMOVE_2.messageEventOccurred(MessageEvents.POST_COMMIT_REMOVE, this, transaction);
            }
            if (POST_COMMIT_REMOVE_1 != null)
            {
                POST_COMMIT_REMOVE_1.messageEventOccurred(MessageEvents.POST_COMMIT_REMOVE, this, transaction);
            }
        } catch (SIException e)
        {
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.store.items.MessageItem.eventPostCommitRemove",
                                        "1:1160:1.244.1.40",
                                        this);

            SibTr.exception(tc, e);

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "eventPostCommitRemove", e);

            throw new SIErrorException(e);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "eventPostCommitRemove");
    }
1344363
protected function submitEditUser()
    {
        if ($this->isPosted('delete')) {
            $this->deleteUser();
        } else if ($this->isPosted('save') && $this->validateEditUser()) {
            if (isset($this->data_user['user_id'])) {
                $this->updateUser();
            } else {
                $this->addUser();
            }
        }
    }
866458
private void postDelete(User user) throws Exception
   {
      for (UserEventListener listener : listeners)
      {
         listener.postDelete(user);
      }
   }
836516
@MainThread
    private void handleEventPost(Event event) {
        Utils.log(event.getKey(), "Handling posted event");

        int sizeBefore = executionQueue.size();

        scheduleStatusUpdates(event, EventStatus.STARTED);
        scheduleSubscribersInvocation(event);

        if (((EventBase) event).handlersCount == 0) {
            Utils.log(event.getKey(), "No subscribers found");
            // Removing all scheduled STARTED status callbacks
            while (executionQueue.size() > sizeBefore) {
                executionQueue.removeLast();
            }
        } else {
            activeEvents.add(event);
            executeTasks(false);
        }
    }
228469
def increase_posts_count(sender, instance, **kwargs):
    

    if instance.poster is None:
        # An anonymous post is considered. No profile can be updated in
        # that case.
        return

    profile, dummy = ForumProfile.objects.get_or_create(user=instance.poster)
    increase_posts_count = False

    if instance.pk:
        try:
            old_instance = instance.__class__._default_manager.get(pk=instance.pk)
        except ObjectDoesNotExist:  # pragma: no cover
            # This should never happen (except with django loaddata command)
            increase_posts_count = True
            old_instance = None
        if old_instance and old_instance.approved is False and instance.approved is True:
            increase_posts_count = True
    elif instance.approved:
        increase_posts_count = True

    if increase_posts_count:
        profile.posts_count = F('posts_count') + 1
        profile.save()
360487
public function afterDelete()
    {
        parent::afterDelete();
        Question::decrementAnswers($this->question_id);
        Vote::removeRelation($this);
    }
420445
private void postSetEnabled(User user) throws Exception
   {
      for (UserEventListener listener : listeners)
         listener.postSetEnabled(user);
   }