function subscriptions_menu in Subscriptions 5
Same name and namespace in other branches
- 5.2 subscriptions.module \subscriptions_menu()
- 6 subscriptions.module \subscriptions_menu()
- 7 subscriptions.module \subscriptions_menu()
- 2.0.x subscriptions.module.old.php \subscriptions_menu()
Implementation of hook_menu().
File
- ./
subscriptions.module, line 236
Code
function subscriptions_menu($may_cache) {
global $user;
// we need the user to to build some urls
$items = array();
$items[] = array(
'path' => 'admin/settings/subscriptions',
'title' => t('Subscriptions'),
'description' => t('Enables site settings for user subscriptions.'),
'callback' => 'drupal_get_form',
'callback arguments' => 'subscriptions_settings',
'access' => user_access('administer site configuration'),
'type' => MENU_NORMAL_ITEM,
);
if (variable_get('subscriptions_usersmenu', 1) && arg(0) == 'user' && is_numeric(arg(1))) {
$account = user_load(array(
'uid' => arg(1),
));
// User subscription pages
if ($user->uid == $account->uid || user_access('admin users subscriptions')) {
$items[] = array(
'path' => "user/" . arg(1) . "/subscriptions",
'title' => t('Subscriptions'),
'callback' => 'subscriptions_page',
'access' => user_access('maintain own subscriptions'),
'type' => MENU_LOCAL_TASK,
'callback arguments' => array(
arg(1),
"content",
),
);
// User Subscriptions submenus
if (module_exists('blog')) {
$items[] = array(
'path' => "user/" . arg(1) . "/subscriptions/blogs",
'title' => t('blogs'),
'callback' => 'subscriptions_page',
'access' => user_access('subscribe to blogs'),
'type' => MENU_LOCAL_TASK,
'callback arguments' => array(
arg(1),
"blogs",
),
);
}
// comment subscription
$items[] = array(
'path' => "user/" . arg(1) . "/subscriptions/node",
'title' => t('threads'),
'callback' => 'subscriptions_page',
'access' => user_access('subscribe to content'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -1,
'callback arguments' => array(
arg(1),
"content",
),
);
// Content type subscription
$items[] = array(
'path' => "user/" . arg(1) . "/subscriptions/type",
'title' => t('content types'),
'callback' => 'subscriptions_page',
'access' => user_access('subscribe to content types'),
'type' => MENU_LOCAL_TASK,
'callback arguments' => array(
arg(1),
"type",
),
);
// Taxonomy subscription
if (module_exists('taxonomy')) {
$items[] = array(
'path' => "user/" . arg(1) . "/subscriptions/taxonomy",
'title' => t('categories'),
'callback' => 'subscriptions_page',
'access' => user_access('subscribe to taxonomy terms'),
'type' => MENU_LOCAL_TASK,
'callback arguments' => array(
arg(1),
"taxonomy",
),
);
}
// RSS feed of subscriptions
$items[] = array(
'path' => "user/" . arg(1) . "/subscriptions/feed",
'title' => t('rss feed'),
'access' => user_access('maintain own subscriptions'),
'callback' => 'subscriptions_feed',
'type' => MENU_LOCAL_TASK,
'weight' => 1,
'callback arguments' => array(
arg(1),
"feed",
),
);
}
}
// My subscriptions pages
if ($may_cache) {
$items[] = array(
'path' => 'subscriptions',
'title' => t('My subscriptions'),
'access' => user_access('subscribe to content'),
'callback' => 'subscriptions_page',
'type' => MENU_NORMAL_ITEM,
'callback arguments' => array(
$user->uid,
"content",
),
);
// comment subscription
$items[] = array(
'path' => "subscriptions/node",
'title' => t('threads'),
'callback' => 'subscriptions_page',
'access' => user_access('subscribe to content'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -1,
'callback arguments' => array(
$user->uid,
"content",
),
);
// User Subscriptions submenus
if (module_exists('blog')) {
$items[] = array(
'path' => "subscriptions/blogs",
'title' => t('blogs'),
'callback' => 'subscriptions_page',
'access' => user_access('subscribe to blogs'),
'type' => MENU_LOCAL_TASK,
'callback arguments' => array(
$user->uid,
"blogs",
),
);
}
// Content type subscription
$items[] = array(
'path' => "subscriptions/type",
'title' => t('content types'),
'callback' => 'subscriptions_page',
'access' => user_access('subscribe to content types'),
'type' => MENU_LOCAL_TASK,
'callback arguments' => array(
$user->uid,
"type",
),
);
// Taxonomy subscription
if (module_exists('taxonomy')) {
$items[] = array(
'path' => "subscriptions/taxonomy",
'title' => t('categories'),
'callback' => 'subscriptions_page',
'access' => user_access('subscribe to taxonomy terms'),
'type' => MENU_LOCAL_TASK,
'callback arguments' => array(
$user->uid,
"taxonomy",
),
);
}
// RSS feed of subscriptions
$items[] = array(
'path' => "subscriptions/feed",
'title' => t('rss feed'),
'access' => user_access('subscribe to content'),
'callback' => 'subscriptions_feed',
'type' => MENU_LOCAL_TASK,
'weight' => 1,
'callback arguments' => array(
$user->uid,
"feed",
),
);
}
/* hiding reporting stub until there is content behind it
$items[] = array(
'path' => 'admin/subscriptions',
'title' => t('subscriptions'),
'access' => user_access('administer users'),
'callback' => 'subscriptions_page',
);
*/
return $items;
}