diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-10-09 07:19:43 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-10-09 07:19:43 +0000 |
commit | 26d71a670f5f7e5d4828227727d244cb377306a4 (patch) | |
tree | 4308dd4cac03d89a1120c72fa0f496e693b456b2 | |
parent | 2a7c403158164c35bd03da76effab337092c6481 (diff) | |
download | brdo-26d71a670f5f7e5d4828227727d244cb377306a4.tar.gz brdo-26d71a670f5f7e5d4828227727d244cb377306a4.tar.bz2 |
#592704 by BarisW and Mike Wacker: Display number of unapproved comments in the approval queue menu item.
-rw-r--r-- | modules/comment/comment.module | 13 |
1 files changed, 12 insertions, 1 deletions
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, @@ -219,6 +220,16 @@ function comment_menu() { } /** + * 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(). */ function comment_node_type_insert($info) { |