You are here

function _subscriptions_menu in Subscriptions 5.2

Given a base url, returns the user menu definition for given user account.

1 call to _subscriptions_menu()
subscriptions_menu in ./subscriptions.module
Implementation of hook_menu().

File

./subscriptions.module, line 440
Subscriptions module.

Code

function _subscriptions_menu($account, $base) {
  global $user;
  foreach (subscriptions_types() as $stype => $data) {
    if (!strncmp('user/', $base, 5) && (user_access('administer user subscriptions') || user_access($data['access'])) || !strncmp('admin/', $base, 6) && user_access('administer site configuration')) {
      if (!empty($data['page'])) {
        $items[] = array(
          'path' => $base . '/' . $stype,
          'title' => $data['title'],
          'callback' => 'subscriptions_page',
          'access' => TRUE,
          'type' => MENU_LOCAL_TASK,
          'weight' => isset($data['weight']) ? $data['weight'] : 0,
          // $weight,
          'callback arguments' => array(
            $account,
            $stype,
          ),
        );
      }
    }
    if ($base == 'subscriptions' && user_access($data['access'])) {
      $items[] = array(
        'path' => $base . '/add/' . $stype,
        'title' => t('Add subscription'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'subscriptions_add_form',
          $stype,
        ),
        'access' => TRUE,
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => $base . '/del/' . $stype,
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'subscriptions_del_form',
          $stype,
        ),
        'access' => TRUE,
        'type' => MENU_CALLBACK,
      );

      /*
      if ($type == MENU_DEFAULT_LOCAL_TASK) {
        // RSS feed of subscriptions
        $items[] = array(
          'path' => $base .'/feed',
          'title' => t('rss feed'),
          'access' => TRUE,
          'callback' => 'subscriptions_feed',
          'type' => MENU_CALLBACK,
          'weight' => 1,
          'callback arguments' => array($account, 'feed'),
        );
      }
      */
    }
  }
  return $items;
}