Opened 11 years ago
Closed 11 years ago
#30091 closed defect (bug) (duplicate)
Comments cannot be created in scheduled posts
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.0 |
| Component: | Comments | Keywords: | has-patch |
| Focuses: | Cc: |
Description
1) I create a planned post.
2) I open this planned post.
3) I add, using commenting form, some comment.
4) I submit this form.
5) I see white screen (usually, this screen appear, when some bug happens).
Attachments (1)
Change History (8)
#1
@
11 years ago
- Summary changed from Comments is not created in planned posts to Comments cannot be created in scheduled posts
#2
@
11 years ago
Am I right, that I (or other developers) have to implement comment_on_draft action, which will be adding comment to DB?
#3
@
11 years ago
Yeah, it seems to me (but I'm pretty new at this core work) that you need to explicitly add an action to process the comment since the post isn't published/private.
I could only find this post on stackoverflow: http://wordpress.stackexchange.com/questions/121001/enable-commenting-on-front-end-preview-page-for-pending-posts
#5
@
11 years ago
Logically it makes sense to let anyone with the 'edit_posts' capability to make a comment on their own post. Especially since logged in users can see draft posts. 30091.diff fixes this issue. It allows anyone with the 'edit_posts' capability to make comments on scheduled posts. If the current user isn't logged in, this post returns a 404 error anyway.
I was able to replicate, but it doesn't seem to be a bug. The post status object that gets returned has public and private set to false, which triggers this:
} elseif ( ! $status_obj->public && ! $status_obj->private ) { /** * Fires when a comment is attempted on a post in draft mode. * * @since 1.5.1 * * @param int $comment_post_ID Post ID. */ do_action( 'comment_on_draft', $comment_post_ID ); exit; }It appears to be intentional, or at least intentional in the case of posting a comment to a draft (or in this instance, scheduled).
The action has nothing else built onto it in the core to handle it, so you see a white screen due to the exit.