You are here

function hook_privatemsg_message_presave_alter in Privatemsg 6

Same name and namespace in other branches
  1. 6.2 privatemsg.api.php \hook_privatemsg_message_presave_alter()
  2. 7.2 privatemsg.api.php \hook_privatemsg_message_presave_alter()
  3. 7 privatemsg.api.php \hook_privatemsg_message_presave_alter()

Change the message before it is stored.

Alter the message, for example remove recipients that have been detected as invalid or forbidden in the validate hook.

Parameters

$message: Message array

Related topics

1 invocation of hook_privatemsg_message_presave_alter()
_privatemsg_send in ./privatemsg.module
Internal function to save a message.

File

./privatemsg.api.php, line 327
Privatemsg API Documentation

Code

function hook_privatemsg_message_presave_alter(&$message) {

  // delete recipients which have been marked as invalid
  global $_privatemsg_invalid_recipients;
  foreach ($_privatemsg_invalid_recipients as $invalid) {
    unset($message['recipients'][$invalid]);
  }
}