You are here

function privatemsg_menu in Privatemsg 7

Same name and namespace in other branches
  1. 5.3 privatemsg.module \privatemsg_menu()
  2. 5 privatemsg.module \privatemsg_menu()
  3. 6.2 privatemsg.module \privatemsg_menu()
  4. 6 privatemsg.module \privatemsg_menu()
  5. 7.2 privatemsg.module \privatemsg_menu()

Implements hook_menu().

File

./privatemsg.module, line 194
Allows users to send private messages to other users.

Code

function privatemsg_menu() {
  $items['messages'] = array(
    'title' => 'Messages',
    'title callback' => 'privatemsg_title_callback',
    'page callback' => 'privatemsg_list_page',
    'page arguments' => array(
      'list',
    ),
    'file' => 'privatemsg.pages.inc',
    'access callback' => 'privatemsg_user_access',
    'type' => MENU_NORMAL_ITEM,
    'menu_name' => 'user-menu',
  );
  $items['messages/list'] = array(
    'title' => 'Messages',
    'page callback' => 'privatemsg_list_page',
    'page arguments' => array(
      'list',
    ),
    'file' => 'privatemsg.pages.inc',
    'access callback' => 'privatemsg_user_access',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
    'menu_name' => 'user-menu',
  );
  $items['messages/view/%privatemsg_thread'] = array(
    // Set the third argument to TRUE so that we can show access denied instead
    // of not found.
    'load arguments' => array(
      NULL,
      NULL,
      TRUE,
    ),
    'title' => 'Read message',
    'page callback' => 'privatemsg_view',
    'page arguments' => array(
      2,
    ),
    'file' => 'privatemsg.pages.inc',
    'access callback' => 'privatemsg_view_access',
    'access arguments' => array(
      2,
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => -5,
    'menu_name' => 'user-menu',
  );
  $items['messages/delete/%privatemsg_thread/%privatemsg_message'] = array(
    'title' => 'Delete message',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'privatemsg_delete',
      2,
      3,
    ),
    'file' => 'privatemsg.pages.inc',
    'access callback' => 'privatemsg_user_access',
    'access arguments' => array(
      'delete privatemsg',
    ),
    'type' => MENU_CALLBACK,
    'weight' => -10,
    'menu_name' => 'user-menu',
  );
  $items['messages/new'] = array(
    'title' => 'Write new message',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'privatemsg_new',
      2,
      3,
      NULL,
    ),
    'file' => 'privatemsg.pages.inc',
    'access callback' => 'privatemsg_user_access',
    'access arguments' => array(
      'write privatemsg',
    ),
    'type' => MENU_LOCAL_ACTION,
    'weight' => -3,
    'menu_name' => 'user-menu',
  );

  // Auto-completes available user names & removes duplicates.
  $items['messages/autocomplete'] = array(
    'page callback' => 'privatemsg_autocomplete',
    'file' => 'privatemsg.pages.inc',
    'access callback' => 'privatemsg_user_access',
    'access arguments' => array(
      'write privatemsg',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['admin/config/messaging'] = array(
    'title' => 'Messaging',
    'description' => 'Messaging systems.',
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'access administration pages',
    ),
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );
  $items['admin/config/messaging/privatemsg'] = array(
    'title' => 'Private message settings',
    'description' => 'Configure private messaging settings.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'privatemsg_admin_settings',
    ),
    'file' => 'privatemsg.admin.inc',
    'access arguments' => array(
      'administer privatemsg settings',
    ),
    'type' => MENU_NORMAL_ITEM,
  );
  $items['admin/config/messaging/privatemsg/settings'] = array(
    'title' => 'Private message settings',
    'description' => 'Configure private messaging settings.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'privatemsg_admin_settings',
    ),
    'file' => 'privatemsg.admin.inc',
    'access arguments' => array(
      'administer privatemsg settings',
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items['messages/undo/action'] = array(
    'title' => 'Private messages',
    'description' => 'Undo last thread action',
    'page callback' => 'privatemsg_undo_action',
    'file' => 'privatemsg.pages.inc',
    'access arguments' => array(
      'read privatemsg',
    ),
    'type' => MENU_CALLBACK,
    'menu' => 'user-menu',
  );
  $items['user/%/messages'] = array(
    'title' => 'Messages',
    'page callback' => 'privatemsg_list_page',
    'page arguments' => array(
      'list',
      1,
    ),
    'file' => 'privatemsg.pages.inc',
    'access callback' => 'privatemsg_user_access',
    'access arguments' => array(
      'read all private messages',
    ),
    'type' => MENU_LOCAL_TASK,
  );
  return $items;
}