You are here

function _birthdays_upgrade_tokens in Birthdays 7

Upgrades D6 user tokens to new D7 tokens.

Parameters

$text: The old template.

Return value

The new template with upgraded tokens.

2 calls to _birthdays_upgrade_tokens()
BirthdaysUtilityTestCase::testUpgradeTokens in ./birthdays.test
Tests _birthdays_upgrade_tokens().
birthdays_update_7000 in ./birthdays.install
Upgrade the data structure to Drupal 7, creating actions, triggers and fields.

File

./birthdays.install, line 255
Installation file for the Birthdays module.

Code

function _birthdays_upgrade_tokens($text) {

  // The replacements as in user_update_7017(). !password is left unchanged,
  // because it wasn't available in birthday mails anyway.
  $replacements = array(
    '!username' => '[user:name]',
    '!site' => '[site:name]',
    '!login_url' => '[user:one-time-login-url]',
    '!uri' => '[site:url]',
    '!uri_brief' => '[site:url-brief]',
    '!mailto' => '[user:mail]',
    '!date' => '[date:medium]',
    '!login_uri' => '[site:login-url]',
    '!edit_uri' => '[user:edit-url]',
  );

  // Do the replacement.
  return str_replace(array_keys($replacements), $replacements, $text);
}