You are here

function invite_menu in Invite 5

Same name and namespace in other branches
  1. 5.2 invite.module \invite_menu()
  2. 6.2 invite.module \invite_menu()
  3. 7.4 invite.module \invite_menu()
  4. 7.2 invite.module \invite_menu()

Implementation of hook_menu().

File

./invite.module, line 65
Allows your users to send and track invitations to join your site.

Code

function invite_menu($may_cache) {
  global $user;
  $items = array();
  $send_access = user_access('send invitations');
  $track_access = user_access('track invitations');
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/user/invite',
      'title' => 'Invite settings',
      'description' => t('Manage Invite settings'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'invite_settings',
      'access' => user_access('administer site configuration'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'invite/accept',
      'callback' => 'invite_action',
      'access' => TRUE,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'invite',
      'title' => variable_get('invite_page_title', t('Invite your friends and colleagues')),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'invite_form',
        'page',
      ),
      'access' => $send_access,
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'invite/add',
      'title' => t('New invitation'),
      'access' => $send_access,
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -1,
    );
    $items[] = array(
      'path' => 'invite/list',
      'title' => t('Your invitations'),
      'callback' => 'invite_overview',
      'access' => $track_access,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'invite/list/accepted',
      'title' => t('Accepted'),
      'callback' => 'invite_overview',
      'callback arguments' => array(
        'accepted',
      ),
      'access' => $track_access,
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -5,
    );
    $items[] = array(
      'path' => 'invite/list/pending',
      'title' => t('Pending'),
      'callback' => 'invite_overview',
      'callback arguments' => array(
        'pending',
      ),
      'access' => $track_access,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'invite/list/expired',
      'title' => t('Expired'),
      'callback' => 'invite_overview',
      'callback arguments' => array(
        'expired',
      ),
      'access' => $track_access,
      'type' => MENU_LOCAL_TASK,
      'weight' => 5,
    );
    $items[] = array(
      'path' => 'invite/withdraw',
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'invite_delete',
      ),
      'access' => $track_access,
      'type' => MENU_CALLBACK,
    );
  }
  else {
    if ($user->uid && $send_access) {

      // Check for newly registered users
      _invite_check_messages($user->uid);
    }
  }
  return $items;
}