function subscriptions_menu in Subscriptions 5.2
Same name and namespace in other branches
- 5 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 26 - Subscriptions module.
Code
function subscriptions_menu($may_cache) {
global $user;
// we need the user to to build some urls
if ($may_cache) {
$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_form',
'access' => user_access('administer site configuration'),
);
$items[] = array(
'path' => 'admin/settings/subscriptions/settings',
'title' => t('Site settings'),
'weight' => -10,
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[] = array(
'path' => 'admin/settings/subscriptions/userdefaults',
'title' => t('User defaults'),
'weight' => -5,
'callback' => 'subscriptions_page_user_overview',
'callback arguments' => array(
NULL,
),
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'admin/settings/subscriptions/intervals',
'title' => t('Interval'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'subscriptions_intervals',
),
'type' => MENU_LOCAL_TASK,
);
}
else {
define('SUBSCRIPTIONS_UNAVAILABLE', '<span class="error" title="' . t('(unavailable to regular users)') . '">¤</span>');
if (arg(0) == 'subscriptions' || arg(2) == 'subscriptions') {
include_once drupal_get_path('module', 'subscriptions') . '/subscriptions.admin.inc';
}
if ($user->uid && arg(0) == 'admin' && arg(1) == 'settings') {
if ($items = _subscriptions_menu($account, 'admin/settings/subscriptions/userdefaults')) {
foreach ($items as $key => $item) {
if ($item['path'] == 'admin/settings/subscriptions/userdefaults/node') {
unset($items[$key]);
// remove thread subscriptions page from site settings
}
}
$items[] = array(
'path' => 'admin/settings/subscriptions/userdefaults',
'type' => MENU_LOCAL_TASK,
'title' => t('Subscriptions'),
'callback' => 'subscriptions_page_user_overview',
'callback arguments' => array(
NULL,
),
);
$items[] = array(
'path' => 'admin/settings/subscriptions/userdefaults/settings',
'type' => MENU_DEFAULT_LOCAL_TASK,
'title' => t('Overview'),
'weight' => -10,
);
}
}
if ($user->uid && arg(0) == 'user' && is_numeric(arg(1)) && ($user->uid == arg(1) || user_access('administer user subscriptions')) && ($account = user_load(array(
'uid' => arg(1),
)))) {
// User subscription pages
if ($user->uid == $account->uid || user_access('administer user subscriptions')) {
if ($items = _subscriptions_menu($account, 'user/' . $account->uid . '/subscriptions')) {
$items[] = array(
'path' => 'user/' . $account->uid . '/subscriptions',
'type' => MENU_LOCAL_TASK,
'title' => t('Subscriptions'),
'callback' => 'subscriptions_page_user_overview',
'callback arguments' => array(
$account,
),
);
$items[] = array(
'path' => 'user/' . $account->uid . '/subscriptions/overview',
'type' => MENU_DEFAULT_LOCAL_TASK,
'title' => t('Overview'),
'weight' => -10,
);
}
}
}
if (arg(0) == 'subscriptions') {
$items = _subscriptions_menu($user, 'subscriptions');
}
// Unsubscribe links
if (arg(0) == 's' && arg(1) == 'del' && arg(7) == md5(drupal_get_private_key() . arg(2) . arg(3) . arg(4) . arg(5) . arg(6))) {
$items[] = array(
'path' => 's/del',
'access' => TRUE,
'callback' => 'drupal_get_form',
'callback arguments' => array(
'subscriptions_delete_form',
),
'type' => MENU_CALLBACK,
);
}
}
return $items;
}