Added speech bubble indicator of items in the moderation queue to the Moderation menu item

(DBOINCP-102)
This commit is contained in:
Tristan Olive 2015-06-04 14:23:43 -04:00
parent 04172928cd
commit 20359124f7
2 changed files with 23 additions and 0 deletions

View File

@ -1288,6 +1288,21 @@ function boincuser_moderate_community_access() {
return FALSE;
}
/**
* Get the count of items in the moderation queue
*/
function boincuser_moderation_queue_count() {
if (user_access(array('edit any profile content'))) {
return db_result(db_query("
SELECT COUNT(*)
FROM {node}
WHERE type = 'profile'
AND moderate = 1"
));
}
return NULL;
}
/**
* Controller for handling simple user account status configuration.
* Allow community membership status to be set for users by direct link rather

View File

@ -100,6 +100,14 @@ function boinc_links__system_main_menu($links, $menu, $element) {
}
}
}
// Put a count of items on the Moderation menu item
if ($link['href'] == 'moderate') {
$item_count = boincuser_moderation_queue_count();
if ($item_count) {
$link['title'] .= ' <div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>';
$link['html'] = TRUE;
}
}
$html .= l($link['title'], $link['href'], $link);
$html .= '</li>';
$i++;