You are here

function advuser_update_6300 in Advanced User 6.3

Same name and namespace in other branches
  1. 7.3 advuser.install \advuser_update_6300()

Updating substitution tokens from Advanced User module only tokens to Token module tokens.

File

./advuser.install, line 73

Code

function advuser_update_6300() {
  $ret = array();
  $variables_to_update = array(
    'advuser_modify_mail',
    'advuser_modify_subject',
    'advuser_new_mail',
    'advuser_new_subject',
  );
  $token_substitutions = array(
    '%user_name' => '[user-raw]',
    '%site' => '[site-name]',
    '%uri' => '[account-url]',
    '%user_email' => '[mail]',
    '%user_status' => '[advuser-status]',
    '%user_theme' => '[advuser-theme]',
    '%user_created' => '[advuser-created]',
    '%user_language' => '[advuser-language]',
    '%user_timezone' => '[advuser-timezone]',
    '%user_signature' => '[advuser-signature-raw]',
  );
  foreach ($variables_to_update as $variable) {
    $current = variable_get($variable, '');
    if (strlen($current) == 0) {
      continue;
    }
    $new = str_replace(array_keys($token_substitutions), array_values($token_substitutions), $current);
    variable_set($variable, $new);
    $ret[] = update_sql($query);
  }
  return $ret;
}