From 26d71a670f5f7e5d4828227727d244cb377306a4 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Fri, 9 Oct 2009 07:19:43 +0000 Subject: #592704 by BarisW and Mike Wacker: Display number of unapproved comments in the approval queue menu item. --- modules/comment/comment.module | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'modules/comment/comment.module') diff --git a/modules/comment/comment.module b/modules/comment/comment.module index baf5b2e85..b9b7cd18c 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -170,7 +170,8 @@ function comment_menu() { 'weight' => -10, ); $items['admin/content/comment/approval'] = array( - 'title' => 'Approval queue', + 'title' => 'Unapproved comments', + 'title callback' => 'comment_count_unpublished', 'page arguments' => array('approval'), 'access arguments' => array('administer comments'), 'type' => MENU_LOCAL_TASK, @@ -218,6 +219,16 @@ function comment_menu() { return $items; } +/** + * Returns a menu title which includes the number of unapproved comments. + */ +function comment_count_unpublished() { + $count = db_query('SELECT COUNT(cid) FROM {comment} WHERE status = :status', array( + ':status' => COMMENT_NOT_PUBLISHED, + ))->fetchField(); + return t('Unapproved comments (@count)', array('@count' => $count)); +} + /** * Implement hook_node_type_insert(). */ -- cgit v1.2.3