Closed (fixed)
Project:
User Referral
Version:
6.x-1.x-dev
Component:
Code: referral
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Feb 2010 at 18:18 UTC
Updated:
22 Mar 2010 at 14:50 UTC
I've added token support to the referral.module. Try it out - just paste the code below into the bottom of the module, and it should work fine.
<?php
/**
* Implementation of hook_token_values().
*/
function referral_token_values($type, $object = NULL, $options = array()) {
if ($type == 'user') {
$tokens = array(
'referral-link' => url('referral/'. _referral_uid2ref($object->uid), array('query' => NULL, 'fragment' => NULL, 'absolute' => TRUE)),
);
return $tokens;
}
}
/**
* Implementation of hook_token_list().
*/
function referral_token_list($type = 'all') {
if ($type == 'user' || $type == 'all') {
$tokens['user'] = array(
'referral-link' => t('The referral link for this user.'),
);
return $tokens;
}
}
?>
Comments
Comment #1
kbahey commentedIf someone tests it and finds that it works, I will commit it.
Comment #2
phacts commentedI've just used it on a production site (with the mailchimp module, I'm sending the referral link to mailchimp via the token), and it works great. Of course, I've only been using it for 2 hours!
Comment #3
kbahey commentedOK, post again in a couple of days. If all is well, I will commit it.
Comment #4
phacts commentedIt still works - I've been using it now for two weeks on the production site, and the token generates correctly every time.
Comment #5
kbahey commentedI committed the code. The only thing I changed is I removed this part:
'query' => NULL, 'fragment' => NULL,A tarball will be created in about 12 hours from the time of this message.
Please wait until then and test it. Post here if it does not work.