function privatemsg_message_change_status

1 privatemsg.module privatemsg_message_change_status($pmid, $status, $account = NULL)
7-1 privatemsg.module privatemsg_message_change_status($pmid, $status, $account = NULL)
7-2 privatemsg.module privatemsg_message_change_status($pmid, $status, $account = NULL)
6-2 privatemsg.module privatemsg_message_change_status($pmid, $status, $account = NULL)

Changes the read/new status of a single message.

Parameters

$pmid: Message id

$status: Either PRIVATEMSG_READ or PRIVATEMSG_UNREAD

$account: User object, defaults to the current user

1 call to privatemsg_message_change_status()
privatemsg_view in ./privatemsg.pages.inc
Menu callback for viewing a thread.

File

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

Code

function privatemsg_message_change_status($pmid, $status, $account = NULL) {
  if (!$account) {
    global $user;
    $account = $user;
  }
  db_update('pm_index')->fields(array('is_new' => $status))->condition('mid', $pmid)->condition('recipient', $account->uid)->condition('type', array('hidden', 'user'))->execute();

  // Allows modules to respond to the status change.
  module_invoke_all('privatemsg_message_status_changed', $pmid, $status, $account);
}