Don't accept comments on drafts - http://mosquito.wordpress.org/view.php?id=946
git-svn-id: https://develop.svn.wordpress.org/trunk@2580 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
74af4dfeec
commit
423287de0d
@ -3,14 +3,17 @@ require( dirname(__FILE__) . '/wp-config.php' );
|
||||
|
||||
$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);
|
||||
exit;
|
||||
} elseif ( 'closed' == $post_status ) {
|
||||
} elseif ( 'closed' == $status->comment_status ) {
|
||||
do_action('comment_closed', $comment_post_ID);
|
||||
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']);
|
||||
|
Loading…
Reference in New Issue
Block a user