Make WordPress Core

Changeset 14086


Ignore:
Timestamp:
04/14/2010 02:07:48 PM (13 years ago)
Author:
ryan
Message:

Register 'inherit' as a post status. Check the parent post status when commenting on attachments.

Location:
trunk
Files:
2 edited

Legend:

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

    r13200 r14086  
    2020$comment_post_ID = isset($_POST['comment_post_ID']) ? (int) $_POST['comment_post_ID'] : 0;
    2121
    22 $status = $wpdb->get_row( $wpdb->prepare("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) );
     22$post = get_post($comment_post_ID);
    2323
    24 if ( empty($status->comment_status) ) {
     24if ( empty($post->comment_status) ) {
    2525    do_action('comment_id_not_found', $comment_post_ID);
    2626    exit;
    2727}
    2828
    29 $status_obj = get_post_status_object($status->post_status);
     29// get_post_status() will get the parent status for attachments.
     30$status = get_post_status($post);
     31
     32$status_obj = get_post_status_object($status);
    3033
    3134if ( !comments_open($comment_post_ID) ) {
    3235    do_action('comment_closed', $comment_post_ID);
    3336    wp_die( __('Sorry, comments are closed for this item.') );
    34 } elseif ( 'trash' == $status->post_status ) {
     37} elseif ( 'trash' == $status ) {
    3538    do_action('comment_on_trash', $comment_post_ID);
    3639    exit;
     
    6568    }
    6669} else {
    67     if ( get_option('comment_registration') || 'private' == $status->post_status )
     70    if ( get_option('comment_registration') || 'private' == $status )
    6871        wp_die( __('Sorry, you must be logged in to post a comment.') );
    6972}
  • trunk/wp-includes/post.php

    r14071 r14086  
    116116                                            '_builtin' => true, /* internal use only. */
    117117                                            'label_count' => _n_noop('Auto-Draft <span class="count">(%s)</span>', 'Auto-Drafts <span class="count">(%s)</span>')
     118                                        ) );
     119
     120    register_post_status( 'inherit', array( 'label' => _x('Inherit', 'post'),
     121                                            'internal' => true,
     122                                            '_builtin' => true, /* internal use only. */
     123                                            'label_count' => _n_noop('Inherit <span class="count">(%s)</span>', 'Inherit <span class="count">(%s)</span>')
    118124                                        ) );
    119125}
Note: See TracChangeset for help on using the changeset viewer.