Make WordPress Core

Changeset 7853


Ignore:
Timestamp:
04/29/2008 06:35:24 PM (17 years ago)
Author:
ryan
Message:

Use wp_count_comments() instead of direct query.

File:
1 edited

Legend:

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

    r7731 r7853  
    2424
    2525    // Recent Comments Widget
    26     if ( current_user_can( 'moderate_comments' ) && $mod_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'") ) {
     26    $mod_comments = wp_count_comments();
     27    $mod_comments = $mod_comments->moderated;
     28    if ( current_user_can( 'moderate_comments' ) && $mod_comments ) {
    2729        $notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments );
    2830        $notice = "<a href='edit-comments.php?comment_status=moderated'>$notice</a>";
Note: See TracChangeset for help on using the changeset viewer.