You are here

function masquerade_menu in Masquerade 6

Same name and namespace in other branches
  1. 5 masquerade.module \masquerade_menu()
  2. 7 masquerade.module \masquerade_menu()

Implementation of hook_menu().

File

./masquerade.module, line 66
masquerade.module

Code

function masquerade_menu() {
  $items = array();
  $default_test_user = _masquerade_user_load(variable_get('masquerade_test_user', ''));
  if ($default_test_user && ($default_test_user->uid || $default_test_user->name == variable_get('anonymous', t('Anonymous')))) {
    $items['masquerade/switch/' . $default_test_user->uid] = array(
      'title' => 'Masquerade as @testuser',
      'title arguments' => array(
        '@testuser' => $default_test_user->name,
      ),
      'page callback' => 'masquerade_switch_user_page',
      'page arguments' => array(
        2,
      ),
      'access callback' => 'masquerade_access',
      'access arguments' => array(
        'switch',
      ),
      'type' => MENU_NORMAL_ITEM,
    );
  }
  $items['masquerade/switch/%'] = array(
    'title' => 'Masquerading',
    'page callback' => 'masquerade_switch_user_page',
    'page arguments' => array(
      2,
    ),
    'access callback' => 'masquerade_access',
    'access arguments' => array(
      'switch',
      2,
    ),
    'type' => MENU_NORMAL_ITEM,
  );
  $items['masquerade/unswitch'] = array(
    'title' => 'Switch back',
    'page callback' => 'masquerade_switch_back_page',
    'access callback' => 'masquerade_access',
    'access arguments' => array(
      'unswitch',
    ),
    'type' => MENU_NORMAL_ITEM,
  );
  $items['masquerade/autocomplete'] = array(
    'title' => '',
    'page callback' => 'masquerade_autocomplete',
    'access callback' => 'masquerade_access',
    'access arguments' => array(
      'autocomplete',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['masquerade/autocomplete/multiple'] = array(
    'title' => '',
    'page callback' => 'masquerade_autocomplete_multiple',
    'access callback' => 'masquerade_access',
    'access arguments' => array(
      'autocomplete',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['masquerade/autocomplete-user'] = array(
    'title' => 'Masquerade autocomplete',
    'page callback' => 'masquerade_autocomplete_user',
    'access arguments' => array(
      'access user profiles',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['admin/settings/masquerade'] = array(
    'title' => 'Masquerade',
    'description' => 'Masquerade module allows administrators to masquerade as other users.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'masquerade_admin_settings',
    ),
    'access callback' => 'user_access',
    'access arguments' => array(
      'administer masquerade',
    ),
    'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}