Make WordPress Core

Ticket #28080: 28080.patch

File 28080.patch, 4.1 KB (added by couturefreak, 9 years ago)

Enables comment meta boxes for posts that have comments already.

  • src/wp-admin/edit-form-advanced.php

     
    199199        add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name ) );
    200200}
    201201
    202 if ( post_type_supports($post_type, 'page-attributes') )
    203         add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core');
     202if ( post_type_supports( $post_type, 'page-attributes' ) ) {
     203        add_meta_box( 'pageparentdiv', 'page' == $post_type ? __( 'Page Attributes' ) : __( 'Attributes' ), 'page_attributes_meta_box', null, 'side', 'core' );
     204}
    204205
    205 if ( $thumbnail_support && current_user_can( 'upload_files' ) )
    206         add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');
     206if ( $thumbnail_support && current_user_can( 'upload_files' ) ) {
     207        add_meta_box( 'postimagediv', __( 'Featured Image' ), 'post_thumbnail_meta_box', null, 'side', 'low' );
     208}
    207209
    208 if ( post_type_supports($post_type, 'excerpt') )
    209         add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core');
     210if ( post_type_supports( $post_type, 'excerpt' ) ) {
     211        add_meta_box( 'postexcerpt', __( 'Excerpt' ), 'post_excerpt_meta_box', null, 'normal', 'core' );
     212}
    210213
    211 if ( post_type_supports($post_type, 'trackbacks') )
    212         add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core');
     214if ( post_type_supports( $post_type, 'trackbacks' ) ) {
     215        add_meta_box( 'trackbacksdiv', __( 'Send Trackbacks' ), 'post_trackback_meta_box', null, 'normal', 'core' );
     216}
    213217
    214 if ( post_type_supports($post_type, 'custom-fields') )
    215         add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core');
     218if ( post_type_supports( $post_type, 'custom-fields' ) ) {
     219        add_meta_box( 'postcustom', __( 'Custom Fields' ), 'post_custom_meta_box', null, 'normal', 'core' );
     220}
    216221
    217222/**
    218223 * Fires in the middle of built-in meta box registration.
    219224 *
    220  * @since 2.1.0
     225 * @since      2.1.0
    221226 * @deprecated 3.7.0 Use 'add_meta_boxes' instead.
    222227 *
    223228 * @param WP_Post $post Post object.
     
    224229 */
    225230do_action( 'dbx_post_advanced', $post );
    226231
    227 if ( post_type_supports($post_type, 'comments') )
    228         add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core');
     232if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) {
     233        add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core' );
     234}
    229235
    230 if ( ( 'publish' == get_post_status( $post ) || 'private' == get_post_status( $post ) ) && post_type_supports($post_type, 'comments') )
    231         add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
     236if ( ( 'publish' == get_post_status( $post ) || 'private' == get_post_status( $post ) ) && ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) ) {
     237        add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core' );
     238}
    232239
    233 if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) )
    234         add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');
     240if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) {
     241        add_meta_box( 'slugdiv', __( 'Slug' ), 'post_slug_meta_box', null, 'normal', 'core' );
     242}
    235243
    236 if ( post_type_supports($post_type, 'author') ) {
    237         if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) )
    238                 add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
     244if ( post_type_supports( $post_type, 'author' ) ) {
     245        if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) {
     246                add_meta_box( 'authordiv', __( 'Author' ), 'post_author_meta_box', null, 'normal', 'core' );
     247        }
    239248}
    240249
    241250/**