WordPress.org

Make WordPress Core

Changeset 13200


Ignore:
Timestamp:
02/18/2010 08:08:35 PM (8 years ago)
Author:
ryan
Message:

Deny commenting on any post with a non-public status. see #9674

File:
1 edited

Legend:

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

    r12647 r13200  
    2525    do_action('comment_id_not_found', $comment_post_ID);
    2626    exit;
    27 } elseif ( !comments_open($comment_post_ID) ) {
     27}
     28
     29$status_obj = get_post_status_object($status->post_status);
     30
     31if ( !comments_open($comment_post_ID) ) {
    2832    do_action('comment_closed', $comment_post_ID);
    2933    wp_die( __('Sorry, comments are closed for this item.') );
    30 } elseif ( in_array($status->post_status, array('draft', 'future', 'pending') ) ) {
    31     do_action('comment_on_draft', $comment_post_ID);
    32     exit;
    3334} elseif ( 'trash' == $status->post_status ) {
    3435    do_action('comment_on_trash', $comment_post_ID);
     36    exit;
     37} elseif ( !$status_obj->public ) {
     38    do_action('comment_on_draft', $comment_post_ID);
    3539    exit;
    3640} elseif ( post_password_required($comment_post_ID) ) {
Note: See TracChangeset for help on using the changeset viewer.