function _privatemsg_delete in Privatemsg 5
Same name and namespace in other branches
- 5.3 privatemsg.module \_privatemsg_delete()
3 calls to _privatemsg_delete()
File
- ./
privatemsg.module, line 2087
Code
function _privatemsg_delete($id, $deleted_status = 1) {
global $user;
$result = db_query('SELECT author, recipient, folder FROM {privatemsg} WHERE (recipient = %d OR author = %d) AND id = %d', $user->uid, $user->uid, $id);
if ($message = db_fetch_object($result)) {
if ($message->author == $user->uid) {
db_query('UPDATE {privatemsg} SET author_del = %d WHERE id = %d', $deleted_status, $id);
$retval = 1;
}
if ($message->recipient == $user->uid) {
db_query('UPDATE {privatemsg} SET recipient_del = %d WHERE id = %d', $deleted_status, $id);
$retval = $message->folder;
}
// Notify other modules that a message is deleted.
privatemsg_invoke_privatemsg($message, 'delete');
return $retval;
}
return FALSE;
}