From c288466b8f3cfbda7f84435c26d178470fc067ca Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 5 Dec 2008 22:33:45 +0000 Subject: [PATCH] Use wp_count_comments() for Right Now. Eliminated a query. git-svn-id: http://svn.automattic.com/wordpress/trunk@10076 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/dashboard.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 5dad0c9fe..80dfc5457 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -173,7 +173,7 @@ function wp_dashboard_right_now() { $num_tags = wp_count_terms('post_tag'); - $num_comm = get_comment_count( ); + $num_comm = wp_count_comments( ); echo "\n\t".'

' . __('At a Glance') . '

'; echo "\n\t".'
'."\n\t".''; @@ -205,11 +205,11 @@ function wp_dashboard_right_now() { */ // Total Comments - $num = number_format_i18n($num_comm['total_comments']); + $num = number_format_i18n($num_comm->total_comments); if ( current_user_can( 'moderate_comments' ) ) $num = "$num"; echo ''; - echo ''; + echo ''; echo ''; @@ -221,11 +221,11 @@ function wp_dashboard_right_now() { echo ''; // Approved Comments - $num = number_format_i18n($num_comm['approved']); + $num = number_format_i18n($num_comm->approved); if ( current_user_can( 'moderate_comments' ) ) $num = "$num"; echo ''; - echo ''; + echo ''; echo "\n\t"; @@ -237,11 +237,11 @@ function wp_dashboard_right_now() { echo ''; // Pending Comments - $num = number_format_i18n($num_comm['awaiting_moderation']); + $num = number_format_i18n($num_comm->moderated); if ( current_user_can( 'moderate_comments' ) ) $num = "$num"; echo ''; - echo ''; + echo ''; echo "\n\t"; @@ -253,11 +253,11 @@ function wp_dashboard_right_now() { echo ''; // Spam Comments - $num = number_format_i18n($num_comm['spam']); + $num = number_format_i18n($num_comm->spam); if ( current_user_can( 'moderate_comments' ) ) $num = "$num"; echo ''; - echo ''; + echo ''; echo ""; do_action('right_now_table_end');
'.$num.'' . __ngettext( 'Comment', 'Comments', $num_comm['total_comments'] ) . '' . __ngettext( 'Comment', 'Comments', $num_comm->total_comments ) . '
' . __ngettext( 'Page', 'Pages', $num_pages->publish ) . ''.$num.'' . __ngettext( 'Approved', 'Approved', $num_comm['approved'] ) . '' . __ngettext( 'Approved', 'Approved', $num_comm->approved ) . '
' . __ngettext( 'Category', 'Categories', $num_cats ) . ''.$num.'' . __ngettext( 'Pending', 'Pending', $num_comm['awaiting_moderation'] ) . '' . __ngettext( 'Pending', 'Pending', $num_comm->moderated ) . '
' . __ngettext( 'Tag', 'Tags', $num_tags ) . ''.$num.'' . __ngettext( 'Spam', 'Spam', $num_comm['spam'] ) . '' . __ngettext( 'Spam', 'Spam', $num_comm->spam ) . '