You are here

function campaignmonitor_menu in Campaign Monitor 5

Same name and namespace in other branches
  1. 5.2 campaignmonitor.module \campaignmonitor_menu()
  2. 6.3 campaignmonitor.module \campaignmonitor_menu()
  3. 6 campaignmonitor.module \campaignmonitor_menu()
  4. 6.2 campaignmonitor.module \campaignmonitor_menu()
  5. 7 campaignmonitor.module \campaignmonitor_menu()

Implementation of hook_menu()

File

./campaignmonitor.module, line 27

Code

function campaignmonitor_menu($may_cache) {
  global $user;
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/campaignmonitor',
      'title' => t('Campaign Monitor'),
      'description' => t('Setup Campaign Monitor values.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'campaignmonitor_admin',
      'access' => user_access('administer campaignmonitor'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'newsletter_archive',
      'title' => t('Newsletter Archive'),
      'callback' => 'campaignmonitor_newsletter_archive',
      'access' => user_access('access archive'),
      'type' => MENU_SUGGESTED_ITEM,
    );
  }
  else {
    if (arg(0) == 'user' && is_numeric(arg(1))) {
      $account = user_load(array(
        'uid' => arg(1),
      ));
      if ($user->uid == $account->uid || user_access('administer users')) {
        $items[] = array(
          'path' => 'user/' . arg(1) . '/newsletters',
          'title' => t('My Newsletters'),
          'callback' => 'campaignmonitor_user_page',
          'type' => MENU_LOCAL_TASK,
          'access' => user_access('join newsletter'),
          'weight' => 5,
        );
      }
    }
  }
  return $items;
}