You are here

function privatemsg_message_change_delete in Privatemsg 6

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

Delete or restore a message.

Parameters

$pmid: Message id, pm.mid field.

$delete: Either deletes or restores the thread (1 => delete, 0 => restore)

$account: User acccount for which the delete action should be carried out - Set to NULL to delete for all users.

Related topics

3 calls to privatemsg_message_change_delete()
PrivatemsgTestCase::testPrivatemsgFlush in ./privatemsg.test
Tests for the flush feature
privatemsg_delete_submit in ./privatemsg.module
privatemsg_thread_change_delete in ./privatemsg.module
Delete or restore one or multiple threads.

File

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

Code

function privatemsg_message_change_delete($pmid, $delete, $account = NULL) {
  $delete_value = 0;
  if ($delete == TRUE) {
    $delete_value = time();
  }
  if ($account) {
    db_query('UPDATE {pm_index} SET deleted = %d WHERE mid = %d AND uid = %d', $delete_value, $pmid, $account->uid);
  }
  else {

    // Mark deleted for all users.
    db_query('UPDATE {pm_index} SET deleted = %d WHERE mid = %d', $delete_value, $pmid);
  }
}