You are here

function privatemsg_message_change_status in Privatemsg 6.2

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

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

2 calls to privatemsg_message_change_status()
privatemsg_update_6003 in ./privatemsg.install
Update function to resolve "forever new" messages.
privatemsg_view in ./privatemsg.pages.inc
Menu callback for viewing a thread.

File

./privatemsg.module, line 809
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;
  }
  $query = "UPDATE {pm_index} SET is_new = %d WHERE mid = %d AND recipient = %d AND type IN ('user', 'hidden')";
  db_query($query, $status, $pmid, $account->uid);

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