You are here

function hook_privatemsg_message_presave_alter in Privatemsg 7

Same name and namespace in other branches
  1. 6.2 privatemsg.api.php \hook_privatemsg_message_presave_alter()
  2. 6 privatemsg.api.php \hook_privatemsg_message_presave_alter()
  3. 7.2 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 function implements hook_privatemsg_message_presave_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

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

File

./privatemsg.api.php, line 239
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]);
  }
}