WordPress.org

Make WordPress Core

Ticket #12991: default_page_comments.patch

File default_page_comments.patch, 2.2 KB (added by messenlehner, 8 years ago)

Update for setting default comments on or off for pages

  • wp-admin/includes/post.php

     
    379379                $post->post_status = 'draft';
    380380                $post->to_ping = '';
    381381                $post->pinged = '';
    382                 $post->comment_status = get_option( 'default_comment_status' );
     382                if($post_type=="page"){
     383                        $post->comment_status = get_option( 'default_comment_status_pages' );
     384                }else{
     385                        $post->comment_status = get_option( 'default_comment_status' );
     386                }
    383387                $post->ping_status = get_option( 'default_ping_status' );
    384388                $post->post_pingback = get_option( 'default_pingback_flag' );
    385389                $post->post_category = get_option( 'default_category' );
  • wp-admin/options-discussion.php

     
    4242<?php _e('Allow people to post comments on new articles') ?></label>
    4343<br />
    4444<small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small>
     45<br />
     46<label for="default_comment_status_pages">
     47<input name="default_comment_status_pages" type="checkbox" id="default_comment_status_pages" value="open" <?php checked('open', get_option('default_comment_status_pages')); ?> />
     48<?php _e('Allow people to post comments on new pages') ?></label>
     49<br />
     50<small><em><?php echo '(' . __('These settings may be overridden for individual pages.') . ')'; ?></em></small>
    4551</fieldset></td>
    4652</tr>
    4753<tr valign="top">
  • wp-includes/post.php

     
    21422142                if ( $update )
    21432143                        $comment_status = 'closed';
    21442144                else
    2145                         $comment_status = get_option('default_comment_status');
     2145                        if($post_type=="page"){
     2146                                $comment_status = get_option( 'default_comment_status_pages' );
     2147                        }else{
     2148                                $comment_status = get_option( 'default_comment_status' );
     2149                        }
    21462150        }
    21472151        if ( empty($ping_status) )
    21482152                $ping_status = get_option('default_ping_status');