PDA

View Full Version : Referral Points not issued.


deb0
01-06-2005, 04:45 PM
Today, i noticed that when I updated user X to specifiy user Y as a referrer, user Y did not get the points for it.

What gives?

Link14716
01-06-2005, 06:50 PM
It only works on register.php. It is not some magical code.

Dan
01-06-2005, 09:23 PM
It only works on register.php. It is not some magical code.
Is there a way we can add some magical code for it?

Link14716
01-06-2005, 09:35 PM
The number of file edits is already painfully large. But if you want me to add yet another one, fine, I'll look into it.

Dan
01-07-2005, 12:34 AM
The number of file edits is already painfully large. But if you want me to add yet another one, fine, I'll look into it.
Did I mention I love you yet Matt?

Link14716
01-07-2005, 01:08 AM
Ok then.

In admincp/user.php, find:
if ($user['referrerid'])
{
$referrername = $DB_site->query_first("SELECT username FROM " . TABLE_PREFIX . "user WHERE userid = $user[referrerid]");
$user['referrer'] = $referrername['username'];
}

Replace with:
if ($user['referrerid'])
{
$referrername = $DB_site->query_first("SELECT username, userid FROM " . TABLE_PREFIX . "user WHERE userid = $user[referrerid]");
$user['referrer'] = $referrername['username'];
construct_hidden_code('user[referrerido]', $referrername['userid']);
}

Find:
if ($referrerid = $DB_site->query_first("SELECT userid FROM " . TABLE_PREFIX . "user WHERE username = '" . addslashes(htmlspecialchars_uni($referrer)) . "'"))
{
$user['referrerid'] = $referrerid['userid'];

Add under:
if ($user['referrerido'] != $user['referrerid'] && $vboptions['uttpoints_enablesystem'] == 1 && $vboptions['uttpoints_pointsperreferral'] != 0) {
$DB_site->query("UPDATE ".TABLE_PREFIX . "$vboptions[uttpoints_pointtable] SET $vboptions[uttpoints_pointsfield]=$vboptions[uttpoints_pointsfield]+$vboptions[uttpoints_pointsperreferral] WHERE userid='".intval($referrerid['userid'])."'");
}
unset($user['referrerido']);

Looks like I will be keeping uCS 0.9x around after the next major release, because this is just a monster now.