You are here

function privatemsg_message_load in Privatemsg 7

Same name and namespace in other branches
  1. 6.2 privatemsg.module \privatemsg_message_load()
  2. 6 privatemsg.module \privatemsg_message_load()
  3. 7.2 privatemsg.module \privatemsg_message_load()

Load a single message.

Parameters

$pmid: Message id, pm.mid field

$account: For which account the message should be loaded. Defaults to the current user.

Related topics

5 calls to privatemsg_message_load()
PrivatemsgTestCase::testPrivatemsgFlush in ./privatemsg.test
Tests for the flush feature
privatemsg_cron in ./privatemsg.module
Implements hook_cron().
privatemsg_message_change_recipient in ./privatemsg.module
Add or remove a recipient to an existing message.
privatemsg_reply in ./privatemsg.module
Send a reply message
theme_privatemsg_list_field__subject in ./privatemsg.theme.inc
Theme the subject of the thread.

File

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

Code

function privatemsg_message_load($pmid, $account = NULL) {

  // If $pmid is object or array - do nothing
  // (fixing conflict with message_load() function in message module).
  if (is_array($pmid) || is_object($pmid)) {
    return NULL;
  }
  $conditions = array();
  if ($account) {
    $conditions['account'] = $account;
  }
  $messages = privatemsg_message_load_multiple(array(
    $pmid,
  ), $conditions);
  return current($messages);
}