You are here

function advuser_tokens in Advanced User 7.3

Implementation of hook_tokens().

File

./advuser.module, line 857
Advanced user module allows you to select users based on an advanced set of filtering and apply actions to block, unblock, delete or email the selected users.

Code

function advuser_tokens($type, $tokens, array $data = array(), array $options = array()) {
  $replacements = array();
  if ($type == 'user') {
    $user =& $data['user'];
    foreach ($tokens as $name => $original) {
      switch ($name) {
        case 'status':
          $replacements[$original] = $user->status ? t('Active') : t('Blocked');
          break;
        case 'theme':
          $replacements[$original] = empty($user->theme) ? t('DEFAULT') : $user->theme;
          break;
        case 'language':
          $replacements[$original] = empty($user->languange) ? t('DEFAULT') : $user->language;
          break;
        case 'timezone':
          $replacements[$original] = empty($user->timezone) ? '0' : $user->timezone;
          break;
        case 'signature':
          $replacements[$original] = check_plain($user->signature);
          break;
        case 'signature:raw':
          $replacements[$original] = $user->signature;
          break;
        case 'name:raw':
          $replacements[$original] = $user->name;
          break;
      }
    }
    return $replacements;
  }
}