function comment_menu in Drupal 5
Same name and namespace in other branches
- 4 modules/comment.module \comment_menu()
- 6 modules/comment/comment.module \comment_menu()
- 7 modules/comment/comment.module \comment_menu()
Implementation of hook_menu().
File
- modules/
comment/ comment.module, line 145 - Enables users to comment on published content.
Code
function comment_menu($may_cache) {
$items = array();
if ($may_cache) {
$access = user_access('administer comments');
$items[] = array(
'path' => 'admin/content/comment',
'title' => t('Comments'),
'description' => t('List and edit site comments and the comment moderation queue.'),
'callback' => 'comment_admin',
'access' => $access,
);
// Tabs:
$items[] = array(
'path' => 'admin/content/comment/list',
'title' => t('List'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
// Subtabs:
$items[] = array(
'path' => 'admin/content/comment/list/new',
'title' => t('Published comments'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[] = array(
'path' => 'admin/content/comment/list/approval',
'title' => t('Approval queue'),
'callback' => 'comment_admin',
'callback arguments' => array(
'approval',
),
'access' => $access,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'admin/content/comment/settings',
'title' => t('Settings'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'comment_admin_settings',
),
'access' => $access,
'weight' => 10,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'comment/delete',
'title' => t('Delete comment'),
'callback' => 'comment_delete',
'access' => $access,
'type' => MENU_CALLBACK,
);
$access = user_access('post comments');
$items[] = array(
'path' => 'comment/edit',
'title' => t('Edit comment'),
'callback' => 'comment_edit',
'access' => $access,
'type' => MENU_CALLBACK,
);
}
else {
if (arg(0) == 'comment' && arg(1) == 'reply' && is_numeric(arg(2))) {
$node = node_load(arg(2));
if ($node->nid) {
$items[] = array(
'path' => 'comment/reply',
'title' => t('Reply to comment'),
'callback' => 'comment_reply',
'access' => node_access('view', $node),
'type' => MENU_CALLBACK,
);
}
}
if (arg(0) == 'node' && is_numeric(arg(1)) && is_numeric(arg(2))) {
$items[] = array(
'path' => 'node/' . arg(1) . '/' . arg(2),
'title' => t('View'),
'callback' => 'node_page_view',
'callback arguments' => array(
node_load(arg(1)),
arg(2),
),
'type' => MENU_CALLBACK,
);
}
}
return $items;
}