Same name and namespace in other branches
- 4.7.x modules/comment.module \comment_menu()
- 5.x modules/comment/comment.module \comment_menu()
- 6.x modules/comment/comment.module \comment_menu()
- 7.x modules/comment/comment.module \comment_menu()
Implementation of hook_menu().
File
- modules/
comment.module, line 84 - 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/comment',
'title' => t('comments'),
'callback' => 'comment_admin_overview',
'access' => $access,
);
$items[] = array(
'path' => 'admin/comment/edit',
'title' => t('edit comment'),
'callback' => 'comment_admin_edit',
'access' => $access,
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'admin/comment/delete',
'title' => t('delete comment'),
'callback' => 'comment_delete',
'access' => $access,
'type' => MENU_CALLBACK,
);
// Tabs:
$items[] = array(
'path' => 'admin/comment/list',
'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[] = array(
'path' => 'admin/comment/configure',
'title' => t('configure'),
'callback' => 'comment_configure',
'access' => $access,
'type' => MENU_LOCAL_TASK,
);
// Subtabs:
$items[] = array(
'path' => 'admin/comment/list/new',
'title' => t('new comments'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[] = array(
'path' => 'admin/comment/list/approval',
'title' => t('approval queue'),
'callback' => 'comment_admin_overview',
'access' => $access,
'callback arguments' => 'approval',
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'admin/comment/configure/settings',
'title' => t('settings'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$access = user_access('administer comments') && user_access('administer moderation');
$items[] = array(
'path' => 'admin/comment/configure/matrix',
'title' => t('moderation matrix'),
'callback' => 'comment_matrix_settings',
'access' => $access,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'admin/comment/configure/thresholds',
'title' => t('moderation thresholds'),
'callback' => 'comment_threshold_settings',
'access' => $access,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'admin/comment/configure/roles',
'title' => t('moderation roles'),
'callback' => 'comment_role_settings',
'access' => $access,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'admin/comment/configure/votes',
'title' => t('moderation votes'),
'callback' => 'comment_vote_settings',
'access' => $access,
'type' => MENU_LOCAL_TASK,
);
$access = user_access('post comments');
$items[] = array(
'path' => 'comment/edit',
'title' => t('edit comment'),
'callback' => 'comment_edit',
'access' => $access,
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'comment',
'title' => t('reply to comment'),
'callback' => 'comment_save_settings',
'access' => 1,
'type' => MENU_CALLBACK,
);
}
else {
if (arg(0) == 'comment' && arg(1) == 'reply' && is_numeric(arg(2))) {
$node = node_load(array(
'nid' => arg(2),
));
if ($node->nid) {
$items[] = array(
'path' => 'comment/reply',
'title' => t('reply to comment'),
'callback' => 'comment_reply',
'access' => node_access('view', $node) && user_access('post comments'),
'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',
'type' => MENU_CALLBACK,
);
}
}
return $items;
}