You are here

function messaging_simple_menu in Messaging 5

Same name and namespace in other branches
  1. 6.4 messaging_simple/messaging_simple.module \messaging_simple_menu()
  2. 6 messaging_simple/messaging_simple.module \messaging_simple_menu()
  3. 6.2 messaging_simple/messaging_simple.module \messaging_simple_menu()
  4. 6.3 messaging_simple/messaging_simple.module \messaging_simple_menu()
  5. 7 messaging_simple/messaging_simple.module \messaging_simple_menu()

Implementation of hook_menu().

File

messaging_simple/messaging_simple.module, line 17
Simple messaging using html page. Messaging method plug-in

Code

function messaging_simple_menu($may_cache) {
  global $user;

  // we need the user to to build some urls
  $items = array();
  if (!$may_cache) {
    if (arg(0) == 'user' && is_numeric(arg(1)) && arg(1) > 0) {
      $account = user_load(array(
        'uid' => arg(1),
      ));
      if ($account->uid == $user->uid || user_access('administer messaging')) {
        $items[] = array(
          'path' => 'user/' . $account->uid . '/messages',
          'type' => MENU_LOCAL_TASK,
          'title' => t('Messages'),
          'callback' => 'messaging_simple_user_page',
          'callback arguments' => array(
            $account,
          ),
        );
      }
    }
  }
  return $items;
}