You are here

function referral_tokens in User Referral 7

Implements hook_tokens().

File

./referral.module, line 828
The referral module.

Code

function referral_tokens($type, $tokens, array $data = array(), array $options = array()) {
  if ($type == 'user' && !empty($data['user'])) {
    $object = $data['user'];
    $replacements = array();
    foreach ($tokens as $name => $original) {
      if ($name == 'referral-link') {
        $replacements[$original] = url('referral/' . _referral_uid2ref($object->uid), array(
          'absolute' => TRUE,
        ));
      }
    }
    return $replacements;
  }
}