From f97c96fde0420b11ddc8b6d2e828c4ec8644f718 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 29 Apr 2008 18:30:45 +0000 Subject: [PATCH] Use wp_count_comments() instead of direct query. git-svn-id: http://svn.automattic.com/wordpress/trunk@7851 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/dashboard.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 9ce9db91cf..8c17de4299 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -23,7 +23,9 @@ function wp_dashboard_setup() { /* Register Widgets and Controls */ // 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 = "$notice"; } else {