Changeset 2580

Show
Ignore:
Timestamp:
05/03/05 07:31:29 (3 years ago)
Author:
matt
Message:

Don't accept comments on drafts - http://mosquito.wordpress.org/view.php?id=946

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-comments-post.php

    r2558 r2580  
    44$comment_post_ID = (int) $_POST['comment_post_ID']; 
    55 
    6 $post_status = $wpdb->get_var("SELECT comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'"); 
     6$status = $wpdb->get_row("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'"); 
    77 
    8 if ( empty($post_status) ) { 
     8if ( empty($status->comment_status) ) { 
    99    do_action('comment_id_not_found', $comment_post_ID); 
    1010    exit; 
    11 } elseif ( 'closed' ==  $post_status ) { 
     11} elseif ( 'closed' ==  $status->comment_status ) { 
    1212    do_action('comment_closed', $comment_post_ID); 
    1313    die( __('Sorry, comments are closed for this item.') ); 
     14} elseif ( 'draft' == $status->post_status ) { 
     15    do_action('comment_on_draft', $comment_post_ID); 
     16    exit; 
    1417} 
    1518