Make WordPress Core

Ticket #23233: 23233.2.diff

File 23233.2.diff, 6.7 KB (added by ericlewis, 9 years ago)
  • src/wp-admin/includes/upgrade.php

     
    552552        if ( $wp_current_db_version < 36686 )
    553553                upgrade_450();
    554554
     555        if ( $wp_current_db_version < 37183 )
     556                upgrade_460();
     557
    555558        maybe_disable_link_manager();
    556559
    557560        maybe_disable_automattic_widgets();
     
    16871690        delete_user_setting( 'wplink' );
    16881691}
    16891692
     1693function upgrade_460() {
     1694        // Comment moderation now lives under a single option.
     1695        if ( get_option( 'comment_moderation' ) ) {
     1696                update_option( 'comment_moderation', 'manually_approve' );
     1697        } else if ( get_option( 'comment_whitelist' ) ) {
     1698                update_option( 'comment_moderation', 'whitelist_previous_commenters' );
     1699        }
     1700        delete_option( 'comment_whitelist' );
     1701}
    16901702/**
    16911703 * Executes network-level upgrade routines.
    16921704 *
  • src/wp-admin/options-discussion.php

     
    137137</fieldset></td>
    138138</tr>
    139139<tr>
    140 <th scope="row"><?php _e('Before a comment appears'); ?></th>
    141 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Before a comment appears'); ?></span></legend>
    142 <label for="comment_moderation">
    143 <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> />
    144 <?php _e('Comment must be manually approved'); ?> </label>
    145 <br />
    146 <label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment'); ?></label>
    147 </fieldset></td>
    148 </tr>
    149 <tr>
    150140<th scope="row"><?php _e('Comment Moderation'); ?></th>
    151141<td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Moderation'); ?></span></legend>
     142<label for="comment_moderation_manually_approved">
     143        <input name="comment_moderation" id="comment_moderation_manually_approved" type="radio" value="manually_approve" <?php checked( 'manually_approve', get_option( 'comment_moderation' ) ) ?> />
     144        <?php _e( 'All comments must be manually approved' ); ?>
     145</label>
     146<br />
     147<label for="comment_moderation_whitelist_previous_commenters">
     148        <input name="comment_moderation" id="comment_moderation_whitelist_previous_commenters" type="radio" value="whitelist_previous_commenters" <?php checked( 'whitelist_previous_commenters', get_option( 'comment_moderation' ) ) ?> />
     149        <?php _e( 'Only comments by new commenters must be approved' ); ?>
     150</label>
     151<br />
     152<label for="comment_moderation_approve_all">
     153        <input name="comment_moderation" id="comment_moderation_approve_all" type="radio" value="approve_all" <?php checked( 'approve_all', get_option( 'comment_moderation' ) ) ?> />
     154        <?php _e( 'All comments are automatically approved' ); ?>
     155</label>
    152156<p><label for="comment_max_links"><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="number" step="1" min="0" id="comment_max_links" value="' . esc_attr(get_option('comment_max_links')) . '" class="small-text" />' ); ?></label></p>
    153157
    154158<p><label for="moderation_keys"><?php _e('When a comment contains any of these words in its content, name, URL, email, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so &#8220;press&#8221; will match &#8220;WordPress&#8221;.'); ?></label></p>
  • src/wp-admin/options.php

     
    8383
    8484$whitelist_options = array(
    8585        'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ),
    86         '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' ),
     86        'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', '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' ),
    8787        'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'medium_large_size_w', 'medium_large_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),
    8888        'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ),
    8989        'writing' => array( 'default_category', 'default_email_category', 'default_link_category', 'default_post_format' )
  • src/wp-includes/comment.php

     
    4040        global $wpdb;
    4141
    4242        // If manual moderation is enabled, skip all checks and return false.
    43         if ( 1 == get_option('comment_moderation') )
     43        if ( 'manually_approve' == get_option( 'comment_moderation' ) )
    4444                return false;
    4545
    4646        /** This filter is documented in wp-includes/comment-template.php */
     
    108108         * as well as whether there are any moderation keywords (if set) present in the author
    109109         * email address. If both checks pass, return true. Otherwise, return false.
    110110         */
    111         if ( 1 == get_option('comment_whitelist')) {
     111        if ( 'whitelist_previous_commenters' == get_option('comment_moderation') ) {
    112112                if ( 'trackback' != $comment_type && 'pingback' != $comment_type && $author != '' && $email != '' ) {
    113113                        // expected_slashed ($author, $email)
    114114                        $ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = '1' LIMIT 1");