Ticket #27111: 27111.1.diff
File 27111.1.diff, 2.9 KB (added by , 11 years ago) |
---|
-
src/wp-admin/options-discussion.php
50 50 <br /> 51 51 <label for="default_comment_status"> 52 52 <input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_option('default_comment_status')); ?> /> 53 <?php _e('Allow people to post comments on newarticles'); ?></label>53 <?php _e('Allow people to post comments on articles'); ?></label> 54 54 <br /> 55 55 <p class="description"><?php echo '(' . __( 'These settings may be overridden for individual articles.' ) . ')'; ?></p> 56 56 </fieldset></td> -
src/wp-includes/comment.php
2395 2395 * @return object 2396 2396 */ 2397 2397 function _close_comments_for_old_posts( $posts, $query ) { 2398 if ( empty( $posts ) || ! $query->is_singular() || ! get_option( 'close_comments_for_old_posts' ))2398 if ( empty( $posts ) || ! $query->is_singular() ) 2399 2399 return $posts; 2400 2400 2401 /** 2402 * Filter the list of post types to automatically close comments for. 2403 * 2404 * @since 3.2.0 2405 * 2406 * @param array $post_types An array of registered post types. Default array with 'post'. 2407 */ 2408 $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) ); 2409 if ( ! in_array( $posts[0]->post_type, $post_types ) ) 2410 return $posts; 2401 if ( 'closed' == get_option( 'default_comment_status' ) ) { 2402 $posts[0]->comment_status = 'closed'; 2403 $posts[0]->ping_status = 'closed'; 2404 } 2405 elseif ( get_option( 'close_comments_for_old_posts' ) ) { 2406 /** 2407 * Filter the list of post types to automatically close comments for. 2408 * 2409 * @since 3.2.0 2410 * 2411 * @param array $post_types An array of registered post types. Default array with 'post'. 2412 */ 2413 $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) ); 2414 if ( ! in_array( $posts[0]->post_type, $post_types ) ) 2415 return $posts; 2411 2416 2412 $days_old = (int) get_option( 'close_comments_days_old' );2413 if ( ! $days_old )2414 return $posts;2417 $days_old = (int) get_option( 'close_comments_days_old' ); 2418 if ( ! $days_old ) 2419 return $posts; 2415 2420 2416 if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) { 2417 $posts[0]->comment_status = 'closed'; 2418 $posts[0]->ping_status = 'closed'; 2421 if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) { 2422 $posts[0]->comment_status = 'closed'; 2423 $posts[0]->ping_status = 'closed'; 2424 } 2419 2425 } 2420 2426 2421 2427 return $posts; … … 2432 2438 * @return bool $open 2433 2439 */ 2434 2440 function _close_comments_for_old_post( $open, $post_id ) { 2441 if ( 'closed' == get_option( 'default_comment_status' ) ) { 2442 return false; 2443 } 2444 2435 2445 if ( ! $open ) 2436 2446 return $open; 2437 2447