Don't accept comments on drafts - http://mosquito.wordpress.org/view.php?id=946
git-svn-id: http://svn.automattic.com/wordpress/trunk@2580 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f49bca8131
commit
2fd04bb902
|
@ -3,14 +3,17 @@ require( dirname(__FILE__) . '/wp-config.php' );
|
||||||
|
|
||||||
$comment_post_ID = (int) $_POST['comment_post_ID'];
|
$comment_post_ID = (int) $_POST['comment_post_ID'];
|
||||||
|
|
||||||
$post_status = $wpdb->get_var("SELECT comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'");
|
$status = $wpdb->get_row("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'");
|
||||||
|
|
||||||
if ( empty($post_status) ) {
|
if ( empty($status->comment_status) ) {
|
||||||
do_action('comment_id_not_found', $comment_post_ID);
|
do_action('comment_id_not_found', $comment_post_ID);
|
||||||
exit;
|
exit;
|
||||||
} elseif ( 'closed' == $post_status ) {
|
} elseif ( 'closed' == $status->comment_status ) {
|
||||||
do_action('comment_closed', $comment_post_ID);
|
do_action('comment_closed', $comment_post_ID);
|
||||||
die( __('Sorry, comments are closed for this item.') );
|
die( __('Sorry, comments are closed for this item.') );
|
||||||
|
} elseif ( 'draft' == $status->post_status ) {
|
||||||
|
do_action('comment_on_draft', $comment_post_ID);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment_author = trim($_POST['author']);
|
$comment_author = trim($_POST['author']);
|
||||||
|
|
Loading…
Reference in New Issue