function notifications_page_user_overview in Notifications 5
Menu callback. Overview page for user subscriptions.
1 string reference to 'notifications_page_user_overview'
- notifications_menu in ./
notifications.module - Implementation of hook_menu().
File
- ./
notifications.admin.inc, line 297
Code
function notifications_page_user_overview($account) {
// Build summary
$count = array();
// Query all subscriptions for this user
$result = db_query("SELECT s.type, count(s.sid) as number FROM {notifications} s WHERE s.uid = %d GROUP BY s.type", $account->uid);
while ($subs = db_fetch_object($result)) {
$count[$subs->type] = $subs->number;
}
$header = array(
t('Type'),
t('Number'),
);
$rows = array();
// List types and count for each type
foreach (notifications_subscription_types() as $type => $info) {
$access = user_access('administer notifications') || !empty($info['access']) && user_access($info['access']);
// If no access and no count, skip this type.
// But if no access and there are some we show the type and number without link.
if ($access || !empty($count[$type])) {
$rows[] = array(
$access ? l($info['title'], "user/{$account->uid}/notifications/{$type}") : $info['title'],
isset($count[$type]) ? $count[$type] : 0,
);
}
}
return $rows ? theme('table', $header, $rows) : t('No existing or allowed subscriptions');
}