Use wp_count_comments() instead of direct query.

git-svn-id: https://develop.svn.wordpress.org/trunk@7851 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-04-29 18:30:45 +00:00
parent 4b8125f180
commit e3b31a2165
1 changed files with 3 additions and 1 deletions

View File

@ -23,7 +23,9 @@ function wp_dashboard_setup() {
/* Register Widgets and Controls */ /* Register Widgets and Controls */
// Recent Comments Widget // Recent Comments Widget
if ( current_user_can( 'moderate_comments' ) && $mod_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'") ) { $mod_comments = wp_count_comments();
$mod_commens = $mod_comments->moderated;
if ( current_user_can( 'moderate_comments' ) && $mod_comments ) {
$notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments ); $notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments );
$notice = "<a href='edit-comments.php?comment_status=moderated'>$notice</a>"; $notice = "<a href='edit-comments.php?comment_status=moderated'>$notice</a>";
} else { } else {