function admin_menu_admin_menu in Administration menu 5.2
Same name and namespace in other branches
- 5.3 admin_menu.module \admin_menu_admin_menu()
- 6 admin_menu.inc \admin_menu_admin_menu()
Implementation of hook_admin_menu().
Parameters
array $admin_menu: An array containing the complete administration menu structure, passed by reference.
bool $may_cache: Whether changes will be cached. If new menu items contain dynamic information, such as query strings or user-related data, these should be added on each page request ($may_cache = FALSE).
File
- ./
admin_menu.module, line 388 - Renders a menu tree for administrative purposes as dropdown menu at the top of the window.
Code
function admin_menu_admin_menu(&$admin_menu, $may_cache) {
if (!$may_cache) {
// Add count of active anonymous/authenticated users.
// @see user_block(), user.module
$interval = time() - variable_get('user_block_seconds_online', 900);
$count_anon = sess_count($interval);
$count_auth = db_result(db_query("SELECT COUNT(DISTINCT uid) FROM {sessions} WHERE uid > 0 AND timestamp >= %d", $interval));
$mid_admin = $admin_menu['index']['admin'];
$title = t('Current anonymous / authenticated users');
$icon_users = '<img src="' . base_path() . drupal_get_path('module', 'admin_menu') . '/images/icon_users.png" width="16" height="15" alt="' . $title . '" title="' . $title . '" />';
admin_menu_add_item($admin_menu, $mid_admin, array(
'title' => $count_anon . ' / ' . $count_auth . ' ' . $icon_users,
'path' => user_access('administer users') ? 'admin/user/user' : drupal_get_normal_path(variable_get('site_frontpage', 'node')),
'weight' => -90,
'class' => 'admin-menu-action admin-menu-icon admin-menu-users',
));
}
}