diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 4566e30c3b..4132a6ed72 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -50,8 +50,8 @@ if ( isset($_GET['comment_status']) ) else $comment_status = ''; $status_links = array(); -$num_posts = wp_count_posts('post'); -$stati = array('moderated' => __('Awaiting Moderation'), 'approved' => __('Approved')); +$num_comments = wp_count_comments(); +$stati = array('moderated' => sprintf(__('Awaiting Moderation (%s)'), $num_comments->moderated), 'approved' => __('Approved')); foreach ( $stati as $status => $label ) { $class = ''; @@ -74,7 +74,7 @@ unset($status_links); -
+ comment_ID; ?>" class=''>
|
diff --git a/wp-includes/comment.php b/wp-includes/comment.php
index a90f7cb4fd..383b03d1ad 100644
--- a/wp-includes/comment.php
+++ b/wp-includes/comment.php
@@ -446,6 +446,25 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
return false;
}
+function wp_count_comments() {
+ global $wpdb;
+
+ $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} GROUP BY comment_approved", ARRAY_A );
+
+ $stats = array( );
+ $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
+ foreach( (array) $count as $row_num => $row ) {
+ $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
+ }
+
+ foreach ( $approved as $key ) {
+ if ( empty($stats[$key]) )
+ $stats[$key] = 0;
+ }
+
+ return (object) $stats;
+}
+
/**
* wp_delete_comment() - Removes comment ID and maybe updates post comment count
*