WordPress.org

Make WordPress Core

Ticket #8175: 8175.patch

File 8175.patch, 2.5 KB (added by Viper007Bond, 10 years ago)
  • wp-admin/includes/dashboard.php

     
    2828        wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' );
    2929
    3030        // Recent Comments Widget
    31         wp_add_dashboard_widget( 'dashboard_recent_comments', sprintf( __( 'Recent Comments <a href="%s">View all</a>' ), 'edit-comments.php' ), 'wp_dashboard_recent_comments' );
     31        $recent_comments_title = ( current_user_can('edit_posts') ) ? sprintf( __( 'Recent Comments <a href="%s">View all</a>' ), 'edit-comments.php' ) : __( 'Recent Comments' );
     32        wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments' );
    3233
    3334        // Incoming Links Widget
    3435        if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
     
    5253                wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' );
    5354
    5455        // Recent Drafts
    55         wp_add_dashboard_widget( 'dashboard_recent_drafts', sprintf( __( 'Recent Drafts <a href="%s">View all</a>' ), 'edit.php?post_status=draft' ), 'wp_dashboard_recent_drafts' );
     56        if ( current_user_can('edit_posts') )
     57                wp_add_dashboard_widget( 'dashboard_recent_drafts', sprintf( __( 'Recent Drafts <a href="%s">View all</a>' ), 'edit.php?post_status=draft' ), 'wp_dashboard_recent_drafts' );
    5658
    5759
    5860        // Primary feed (Dev Blog) Widget
     
    254256        echo "</tr>";
    255257        do_action('right_now_table_end');
    256258        echo "\n\t</table>\n\t</div>";
    257  
    258   echo "\n\t".'<div class="versions">';
     259
     260        echo "\n\t".'<div class="versions">';
    259261        $ct = current_theme_info();
    260262        $sidebars_widgets = wp_get_sidebars_widgets();
    261263        $num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ), 0 );
     
    273275
    274276        update_right_now_message();
    275277
    276   echo "\n\t".'</div>';
     278        echo "\n\t".'</div>';
    277279        do_action( 'rightnow_end' );
    278280        do_action( 'activity_box_end' );
    279281}
     
    389391 * @since unknown
    390392 */
    391393function wp_dashboard_recent_comments() {
    392         list($comments, $total) = _wp_get_comment_list( '', false, 0, 5 );
     394        $status = ( current_user_can('edit_posts') ) ? '' : 'approved';
    393395
     396        list($comments, $total) = _wp_get_comment_list( $status, false, 0, 5 );
     397
    394398        if ( $comments ) :
    395399?>
    396400