WordPress.org

Make WordPress Core

Ticket #27111: global-comments-off.diff

File global-comments-off.diff, 4.0 KB (added by jackreichert, 6 years ago)

Provides functionality for global comments flag.

  • src/wp-admin/includes/schema.php

    diff --git src/wp-admin/includes/schema.php src/wp-admin/includes/schema.php
    index 90ab600..14395de 100644
    function populate_options() { 
    382382        'mailserver_pass' => 'password',
    383383        'mailserver_port' => 110,
    384384        'default_category' => 1,
     385        'global_comment_status' => 'open',
    385386        'default_comment_status' => 'open',
    386387        'default_ping_status' => 'open',
    387388        'default_pingback_flag' => 1,
  • src/wp-admin/options-discussion.php

    diff --git src/wp-admin/options-discussion.php src/wp-admin/options-discussion.php
    index a02f997..e0f9c50 100644
    include( ABSPATH . 'wp-admin/admin-header.php' ); 
    3838
    3939<table class="form-table">
    4040<tr>
     41<th scope="row"><?php _e('Global comment settings'); ?></th>
     42<td><fieldset><legend class="screen-reader-text"><span><?php _e('Global comment settings'); ?></span></legend>
     43<label for="global_comment_status">
     44<input name="global_comment_status" type="checkbox" id="global_comment_status" value="open" <?php checked('open', get_option('global_comment_status')); ?> />
     45<?php _e('Allow people to post comments on articles'); ?></label>
     46<p class="description"><?php echo '(' . __( 'Disabling this will override settings for all individual articles.' ) . ')'; ?></p>
     47</fieldset>
     48</td>
     49</tr>
     50<tr>
    4151<th scope="row"><?php _e('Default article settings'); ?></th>
    4252<td><fieldset><legend class="screen-reader-text"><span><?php _e('Default article settings'); ?></span></legend>
    4353<label for="default_pingback_flag">
  • src/wp-admin/options.php

    diff --git src/wp-admin/options.php src/wp-admin/options.php
    index 8b84811..e9a2219 100644
    if ( is_multisite() && !is_super_admin() && 'update' != $action ) 
    7171
    7272$whitelist_options = array(
    7373        'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string' ),
    74         'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ),
     74        'discussion' => array( 'global_comment_status', 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ),
    7575        'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),
    7676        'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ),
    7777        'writing' => array( 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'default_post_format' )
  • src/wp-includes/comment-template.php

    diff --git src/wp-includes/comment-template.php src/wp-includes/comment-template.php
    index 3f773af..82ba8de 100644
    function comments_open( $post_id = null ) { 
    971971
    972972        $_post = get_post($post_id);
    973973
    974         $open = ( 'open' == $_post->comment_status );
     974        $open = ( 'open' == $_post->comment_status && 'open' == get_option('global_comment_status') );
    975975
    976976        /**
    977977         * Filter whether the current post is open for comments.