Ticket #23233: 23233.2.diff
File 23233.2.diff, 6.7 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/upgrade.php
552 552 if ( $wp_current_db_version < 36686 ) 553 553 upgrade_450(); 554 554 555 if ( $wp_current_db_version < 37183 ) 556 upgrade_460(); 557 555 558 maybe_disable_link_manager(); 556 559 557 560 maybe_disable_automattic_widgets(); … … 1687 1690 delete_user_setting( 'wplink' ); 1688 1691 } 1689 1692 1693 function 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 } 1690 1702 /** 1691 1703 * Executes network-level upgrade routines. 1692 1704 * -
src/wp-admin/options-discussion.php
137 137 </fieldset></td> 138 138 </tr> 139 139 <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>150 140 <th scope="row"><?php _e('Comment Moderation'); ?></th> 151 141 <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> 152 156 <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> 153 157 154 158 <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 “press” will match “WordPress”.'); ?></label></p> -
src/wp-admin/options.php
83 83 84 84 $whitelist_options = array( 85 85 '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' ), 87 87 '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' ), 88 88 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ), 89 89 'writing' => array( 'default_category', 'default_email_category', 'default_link_category', 'default_post_format' ) -
src/wp-includes/comment.php
40 40 global $wpdb; 41 41 42 42 // 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' ) ) 44 44 return false; 45 45 46 46 /** This filter is documented in wp-includes/comment-template.php */ … … 108 108 * as well as whether there are any moderation keywords (if set) present in the author 109 109 * email address. If both checks pass, return true. Otherwise, return false. 110 110 */ 111 if ( 1 == get_option('comment_whitelist')) {111 if ( 'whitelist_previous_commenters' == get_option('comment_moderation') ) { 112 112 if ( 'trackback' != $comment_type && 'pingback' != $comment_type && $author != '' && $email != '' ) { 113 113 // expected_slashed ($author, $email) 114 114 $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");