Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#30091 closed defect (bug) (duplicate)

Comments cannot be created in scheduled posts

Reported by: Hixon10 Owned by:
Priority: normal Milestone:
Component: Comments Version: 4.0
Severity: normal Keywords: has-patch
Cc: Focuses:

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)

30091.diff (1.7 KB ) - added by voldemortensen 12 years ago.

Download all attachments as: .zip

Change History (8)

#1 @socki03
12 years ago

  • Summary Comments is not created in planned postsComments cannot be created in scheduled posts

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.

#2 @Hixon10
12 years ago

Am I right, that I (or other developers) have to implement comment_on_draft action, which will be adding comment to DB?

Last edited 12 years ago by Hixon10 (previous) (diff)

#3 @socki03
12 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

#4 @Hixon10
12 years ago

Thank you for the link.

#5 @voldemortensen
12 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.

#6 @voldemortensen
12 years ago

  • Keywords has-patch added

#7 @johnbillion
12 years ago

  • Milestone Awaiting Review
  • Resolutionduplicate
  • Status newclosed

Duplicate of #19739.

Note: See TracTickets for help on using tickets.