WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 9 months ago

#19739 new enhancement

Filters to allow comments on draft & trash post_status posts

Reported by: cyberhobo Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.3
Component: Comments Keywords: has-patch needs-testing
Focuses: Cc:

Description

I'd like to use comments on draft posts as part of an editorial workflow. Will this be as easy as adding a filter to fire before the current comment_on_draft action that can be checked before exiting? I'll try that and add a patch if it looks good.

Related #13276. Not relevant to #18630, I think.

Attachments (4)

19739.diff (769 bytes) - added by cyberhobo 4 years ago.
Added a post id parameter and similar filter for comments on trashed posts.
19739.2.diff (1.2 KB) - added by chriscct7 10 months ago.
Second patch
19739.3.diff (1.3 KB) - added by chriscct7 10 months ago.
Move action inside per slack chat
19739.4.diff (1.7 KB) - added by chriscct7 10 months ago.
4th patch version

Download all attachments as: .zip

Change History (14)

@cyberhobo4 years ago

Added a post id parameter and similar filter for comments on trashed posts.

comment:1 @cyberhobo4 years ago

  • Keywords has-patch added

My simple solution works for my use case, and seems pretty low impact. How bout it?

Last edited 3 years ago by cyberhobo (previous) (diff)

comment:2 @chriscct710 months ago

  • Summary changed from Filter to override exit for comments on drafts (comment_on_draft) to Filters to allow comments on draft & trash post_status posts

comment:3 @johnbillion10 months ago

  • Keywords needs-docs needs-patch added; dev-feedback has-patch removed
  • Milestone changed from Awaiting Review to Future Release

Seems sane. A negative hook name isn't a good idea though because you end up with a double negative to enable the functionality:

add_filter( 'deny_comment_on_trash', '__return_false' );

Better hook names would be allow_comment_on_trash and allow_comment_on_draft.

Needs some hook docs too.

@chriscct710 months ago

Second patch

comment:4 @chriscct710 months ago

@johnbillion Does that work?

comment:5 @slackbot10 months ago

This ticket was mentioned in Slack in #core by chriscct7. View the logs.

@chriscct710 months ago

Move action inside per slack chat

@chriscct710 months ago

4th patch version

comment:6 @chriscct710 months ago

  • Keywords has-patch added; needs-docs needs-patch removed

@johnbillion Ready to go

comment:7 @johnbillion10 months ago

  • Milestone changed from Future Release to 4.1

comment:8 @johnbillion10 months ago

#30091 was marked as a duplicate.

comment:9 @johnbillion10 months ago

  • Keywords needs-testing added

Needs testing:

  • When commenting on trashed or draft posts, is the browser redirect and the permalink in the comment notification emails correct? How does the browser redirect for a trashed post work?
  • Do draft posts actually list comments on the front end (in the default themes at least)?

comment:10 @johnbillion9 months ago

  • Milestone changed from 4.1 to Future Release
Note: See TracTickets for help on using tickets.