You are here

function hook_privatemsg_message_recipient_changed in Privatemsg 7

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

This hook is invoked when a recipient is added to a message.

Since the hook might be invoked hundreds of times during batch or cron, only ids are passed and not complete user/message objects.

Parameters

$mid: Id of the message.

$thread_id: Id of the thread the message belongs to.

$recipient: Recipient id, a user id if type is user or hidden.

$type: Type of the recipient.

$added: TRUE if the recipient is added, FALSE if he is removed.

Related topics

1 function implements hook_privatemsg_message_recipient_changed()

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

privatemsg_filter_privatemsg_message_recipient_changed in privatemsg_filter/privatemsg_filter.module
Implements hook_privatemsg_message_recipient_changed().
1 invocation of hook_privatemsg_message_recipient_changed()
privatemsg_message_change_recipient in ./privatemsg.module
Add or remove a recipient to an existing message.

File

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

Code

function hook_privatemsg_message_recipient_changed($mid, $thread_id, $recipient, $type, $added) {
  if ($added && ($type == 'user' || $type == 'hidden')) {
    privatemsg_filter_add_tags(array(
      $thread_id,
    ), variable_get('privatemsg_filter_inbox_tag', ''), (object) array(
      'uid' => $recipient,
    ));
  }
}