As the title says, is there a simple php snippet I can use to display the user's link on a custom page?

Comments

pointdexter02’s picture

Nevermind.....

Didn't have my filter configured.

nyleve101’s picture

Hi,

I'm trying to print the referral link in a block without any luck, did you use the code below?

$referralLink = url('referral/'. _referral_uid2ref($GLOBALS['user']->uid), array('query' => NULL, 'fragment' => NULL, 'absolute' => TRUE));

Hope you're well,

Eve

IWasBornToWin’s picture

I tried the php code in a block using a php filter. Nothing displays....should the word "print" be in there somewhere?

IWasBornToWin’s picture

print does the trick, although, now it is printing it outside the block, not wrapping

IWasBornToWin’s picture

Is there a way to add more to this url, such as referral/f266f778/something/else

IWasBornToWin’s picture

I tried inserting something else after the uid) but it wouldn't display anything, including your original code.

IWasBornToWin’s picture

This code ibeds current user referral code into linki to current page -

Share page (includes your referral code) - <?php
echo $referralLink = url('referral/'. _referral_uid2ref($GLOBALS['user']->uid), array('query' => NULL, 'fragment' => NULL, 'absolute' => TRUE));
echo "?destination=";
echo $_GET['q'];
?>

If an anoymous user comes to the link - it will show the page (if proper permissions are there) and also insert referral cookie on user's computer, giving the referring user credit if anonymous user registers.

destinationsound’s picture

Issue summary: View changes

Any luck with this? I'm trying to get the unique referral code to display inside a block, so i have freedom to place it elsewhere on the site.