WordPress.org

Make WordPress Core

Changeset 9635


Ignore:
Timestamp:
11/12/2008 04:59:19 PM (10 years ago)
Author:
ryan
Message:

Some cap checks for the Dashboard. Props Viper007Bond. fixes #8175

File:
1 edited

Legend:

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

    r9630 r9635  
    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
     
    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
     
    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();
     
    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' );
     
    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';
     395
     396    list($comments, $total) = _wp_get_comment_list( $status, false, 0, 5 );
    393397
    394398    if ( $comments ) :
Note: See TracChangeset for help on using the changeset viewer.