You are here

function rpt_tokens in Registration Password Token 7

Same name and namespace in other branches
  1. 8 rpt.module \rpt_tokens()

Implements hook_tokens().

File

./rpt.module, line 71

Code

function rpt_tokens($type, $tokens, array $data = array(), array $options = array()) {
  $replacements = array();
  foreach ($tokens as $name => $value) {
    if ($name == 'password') {
      if (isset($data['user']) && isset($data['user']->password)) {
        $replacements['[user:password]'] = $data['user']->password;
        $replacements['[account:password]'] = $data['user']->password;
      }
      elseif (isset($data['user']) && !isset($data['user']->password)) {
        $replacements['[user:password]'] = t('Your password');
        $replacements['[account:password]'] = t('Your password');
      }
    }
  }
  return $replacements;
}