From c0bbf8c1bc2d9773a9f4d12700040c614b461db6 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 7 Jan 2010 19:37:16 +0000 Subject: [PATCH] Block comments for future posts and password protected posts (when password not provided). Props filosofo. fixes #11810 for trunk git-svn-id: http://svn.automattic.com/wordpress/trunk@12647 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-comments-post.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-comments-post.php b/wp-comments-post.php index 923b03b99c..e60d159ddc 100644 --- a/wp-comments-post.php +++ b/wp-comments-post.php @@ -27,12 +27,15 @@ if ( empty($status->comment_status) ) { } elseif ( !comments_open($comment_post_ID) ) { do_action('comment_closed', $comment_post_ID); wp_die( __('Sorry, comments are closed for this item.') ); -} elseif ( in_array($status->post_status, array('draft', 'pending') ) ) { +} elseif ( in_array($status->post_status, array('draft', 'future', 'pending') ) ) { do_action('comment_on_draft', $comment_post_ID); exit; } elseif ( 'trash' == $status->post_status ) { do_action('comment_on_trash', $comment_post_ID); exit; +} elseif ( post_password_required($comment_post_ID) ) { + do_action('comment_on_password_protected', $comment_post_ID); + exit; } else { do_action('pre_comment_on_post', $comment_post_ID); }