You are here

function _pm_email_notify_token in Privatemsg 6

Same name and namespace in other branches
  1. 6.2 pm_email_notify/pm_email_notify.module \_pm_email_notify_token()

Return an array of token to value mappings for user e-mail messages.

Parameters

$message: The private message array being sent. Must contain at least the fields 'author', 'subject', 'thread_id' and 'body'.

Return value

Array of mappings from token names to values (for use with strtr()).

1 call to _pm_email_notify_token()
pm_email_notify_mail in pm_email_notify/pm_email_notify.module
Implements hook_mail().

File

pm_email_notify/pm_email_notify.module, line 125
Notifies users about new Private Messages via Email.

Code

function _pm_email_notify_token($recipient, $message, $language) {
  $tokens = array(
    '!author_uid' => $message['author']->uid,
    '!author' => $message['author']->name,
    '!pm_subject' => trim(drupal_html_to_text(check_plain($message['subject']))),
    '!pm_body' => trim(drupal_html_to_text(check_markup($message['body'], $message['format'], FALSE))),
    '!thread' => $message['thread_id'],
    '!user_uid' => $recipient->uid,
    '!message' => url('messages/view/' . $message['thread_id'], array(
      'absolute' => TRUE,
      'language' => $language,
    )),
    '!settings' => url('user/' . $recipient->uid . '/edit', array(
      'absolute' => TRUE,
      'language' => $language,
    )),
  );
  return $tokens;
}