Make WordPress Core


Ignore:
Timestamp:
03/10/2008 10:59:57 PM (19 years ago)
Author:
ryan
Message:

Add cap checks to dash. Props mdawaffe. fixes #5858

File:
1 edited

Legend:

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

    r7178 r7217  
    2323
    2424        // Recent Comments Widget
    25         if ( $mod_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'") ) {
     25        if ( current_user_can( 'moderate_comments' ) && $mod_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'") ) {
    2626                $notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments );
    2727                $notice = "<a href='moderation.php'>$notice</a>";
     
    128128
    129129        // Hard code the sidebar's widgets and order
    130         $dashboard_widgets = array( 'dashboard_recent_comments', 'dashboard_incoming_links', 'dashboard_primary', 'dashboard_plugins', 'dashboard_secondary' );
     130        $dashboard_widgets = array();
     131        $dashboard_widgets[] = 'dashboard_recent_comments';
     132        $dashboard_widgets[] = 'dashboard_incoming_links';
     133        $dashboard_widgets[] = 'dashboard_primary';
     134        if ( current_user_can( 'activate_plugins' ) )
     135                $dashboard_widgets[] = 'dashboard_plugins';
     136        $dashboard_widgets[] = 'dashboard_secondary';
    131137
    132138        // Filter widget order
Note: See TracChangeset for help on using the changeset viewer.