Make WordPress Core


Ignore:
Timestamp:
12/14/2010 05:58:47 PM (14 years ago)
Author:
nacin
Message:

Remove ceilings on recent comments and posts widgets and dashboard widgets. fixes #14543.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/dashboard.php

    r16900 r16922  
    607607
    608608    $widgets = get_option( 'dashboard_widget_options' );
    609     if ( isset( $widgets['dashboard_recent_comments'] ) && isset( $widgets['dashboard_recent_comments']['items'] ) )
    610         $total_items = (int) $widgets['dashboard_recent_comments']['items'];
    611     else
    612         $total_items = 5;
     609    $total_items = isset( $widgets['dashboard_recent_comments'] ) && isset( $widgets['dashboard_recent_comments']['items'] )
     610        ? absint( $widgets['dashboard_recent_comments']['items'] ) : 5;
    613611
    614612    while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) {
     
    758756
    759757    if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-recent-comments']) ) {
    760         $number = (int) stripslashes($_POST['widget-recent-comments']['items']);
    761         if ( $number < 1 || $number > 30 )
    762             $number = 5;
     758        $number = absint( stripslashes($_POST['widget-recent-comments']['items']) );
    763759        $widget_options['dashboard_recent_comments']['items'] = $number;
    764760        update_option( 'dashboard_widget_options', $widget_options );
     
    768764
    769765    echo '<p><label for="comments-number">' . __('Number of comments to show:') . '</label>';
    770     echo '<input id="comments-number" name="widget-recent-comments[items]" type="text" value="' . $number . '" size="3" /> <small>' . __( '(at most 30)' ) . '</small></p>';
     766    echo '<input id="comments-number" name="widget-recent-comments[items]" type="text" value="' . $number . '" size="3" /></p>';
    771767}
    772768
Note: See TracChangeset for help on using the changeset viewer.