You are here

function privatemsg_list_page in Privatemsg 7

Same name and namespace in other branches
  1. 6.2 privatemsg.pages.inc \privatemsg_list_page()
  2. 7.2 privatemsg.pages.inc \privatemsg_list_page()

List messages.

Parameters

$argument: An argument to pass through to the query builder.

$uid: User id messages of another user should be displayed

Return value

Form array

2 string references to 'privatemsg_list_page'
privatemsg_filter_menu in privatemsg_filter/privatemsg_filter.module
Implements hook_menu().
privatemsg_menu in ./privatemsg.module
Implements hook_menu().

File

./privatemsg.pages.inc, line 136
User menu callbacks for Privatemsg.

Code

function privatemsg_list_page($argument = 'list', $uid = NULL) {
  global $user;

  // Setting default behavior...
  $account = $user;

  // Because uid is submitted by the menu system, it's a string not a integer.
  if ((int) $uid > 0 && $uid != $user->uid) {

    // Trying to view someone else's messages...
    if (!($account_check = user_load($uid))) {
      return MENU_NOT_FOUND;
    }
    if (!privatemsg_user_access('read all private messages')) {
      return MENU_ACCESS_DENIED;
    }

    // Has rights and user_load return an array so user does exist
    $account = $account_check;
  }
  return drupal_get_form('privatemsg_list', $argument, $account);
}