You are here

function hook_privatemsg_message_recipient_changed in Privatemsg 6.2

Same name and namespace in other branches
  1. 7.2 privatemsg.api.php \hook_privatemsg_message_recipient_changed()
  2. 7 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_id: 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

2 functions implement 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.

pm_email_notify_privatemsg_message_recipient_changed in pm_email_notify/pm_email_notify.module
Implements hook_privatemsg_message_recipient_changed().
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 380
Privatemsg API Documentation

Code

function hook_privatemsg_message_recipient_changed($mid, $thread_id, $recipient_id, $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,
    ));
  }
}