You are here

function pm_email_notify_update_7000 in Privatemsg 7

Same name and namespace in other branches
  1. 7.2 pm_email_notify/pm_email_notify.install \pm_email_notify_update_7000()

Replace old placeholders with new tokens.

File

pm_email_notify/pm_email_notify.install, line 49
This file takes care of creating/deleting pm_email_notify table used for storing user notification preferences

Code

function pm_email_notify_update_7000() {
  $replacements = array(
    '!author' => '[privatemsg_message:author]',
    '!username' => '[privatemsg_message:recipient]',
    '!author_uid' => '[privatemsg_message:author:uid]',
    '!pm_subject' => '[privatemsg_message:subject]',
    '!pm_body' => '[privatemsg_message:body]',
    '!thread' => '[privatemsg_message:thread_id]',
    '!site' => '[site:name]',
    '!login-url' => '[site:login-url]',
    '!uri' => '	[site:url]',
    '!uri_brief' => '[site:url-brief]',
    '!message' => '[privatemsg_message:url]',
    '!settings' => '[privatemsg_message:recipient:edit-url]',
  );

  // Only update if there was actually something saved.
  if ($subject = variable_get('pm_email_notify_subject', FALSE)) {
    variable_set('pm_email_notify_subject', str_replace(array_keys($replacements), array_values($replacements), $subject));
  }
  if ($body = variable_get('pm_email_notify_body', FALSE)) {
    variable_set('pm_email_notify_body', str_replace(array_keys($replacements), array_values($replacements), $body));
  }
}