osDate Forum - osDate Dating Script

osDate => Tips & Tricks => Topic started by: alexchiu on May 15, 2017, 12:27:23 AM

Title: Want to know how to make affiliates name show up on pages.
Post by: alexchiu on May 15, 2017, 12:27:23 AM
Want to know how to make affiliates name show up on pages.  For example 'You have been referred by some dude.'
Title: Re: Want to know how to make affiliates name show up on pages.
Post by: Pharg on May 15, 2017, 12:32:57 AM
Hi alexchiu,

Sorry but don't know, you will have to hire a coder for that, as it's custom work.
Title: Re: Want to know how to make affiliates name show up on pages.
Post by: KHDev on May 15, 2017, 05:21:57 PM
You could probably do something like:

Add something like this to init.php somewhere near the bottom of the file

Code: [Select]
if(isset($_SESSION['ReferalId'])){

$affid2=intval($_SESSION['ReferalId']);
$affName = $osDB->getOne('SELECT name FROM ! WHERE id = ?', array(AFFILIATE_TABLE, $affid2));

if(!empty($affName)){
$t->assign ('affName', $affName);
}

}else{
$t->assign ('affName', '');
}

Then in your template file/s where you want to display it, you could use something like:

Code: [Select]
{if $affName != ''}
<div>
You have been referred by: <b>{$affName}</b>
</div>
{/if}

Just basic, but should point you in the right direction.

:)