You are here

function realname_menu in Real Name 5

Same name and namespace in other branches
  1. 6 realname.module \realname_menu()
  2. 7 realname.module \realname_menu()

Implementation of hook_menu().

File

./realname.module, line 46
The RealName module allows the admin to choose fields from the user profile that will be used to add a "realname" element (method) to a user object. Hook_user is used to automatically add this to any user object that is loaded.

Code

function realname_menu($may_cache) {
  global $user;
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/user/realname',
      'title' => t('RealName'),
      'description' => t("Configure which fields are used to create a user's RealName."),
      'access' => user_access('administer users'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'realname_admin_settings',
      ),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/user/realname/fields',
      'title' => t('Fields'),
      'access' => user_access('administer users'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'realname_admin_fields',
      ),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => 0,
    );
    $items[] = array(
      'path' => 'admin/user/realname/bypass',
      'title' => t('Bypass Forms'),
      'access' => user_access('administer users'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'realname_admin_bypass',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 2,
    );

    // CCK Userref intercept.
    $items[] = array(
      'path' => 'realname/userref/autocomplete',
      'title' => t('RealName user reference autocomplete'),
      'callback' => 'realname_userref_autocomplete',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );

    // Privatemsg intercept.
    $items[] = array(
      'path' => 'realname/privatemsg/autocomplete',
      'title' => t('Realname Privatemsg autocomplete'),
      'callback' => 'realname_privatemsg_autocomplete',
      'access' => user_access('access private messages'),
      'type' => MENU_CALLBACK,
    );
  }
  else {

    // If desired, load the theme override file.
    if (variable_get('realname_theme', TRUE)) {
      include_once drupal_get_path('module', 'realname') . '/realname_theme.inc';
    }
  }
  return $items;
}