Author Topic: Refer a friend, get credits?  (Read 6585 times)

Offline Teun

Refer a friend, get credits?
« on: May 15, 2007, 06:48:17 pm »
Is that possible? A user gets his own refer code, and everytime someone clicks on the link (or registers), the user gets a certain ammount of Credits?

Hendricius

  • Guest
Re: Refer a friend, get credits?
« Reply #1 on: May 20, 2007, 08:28:40 am »
This sounds like a really good idea :)

Offline feildmaster

Re: Refer a friend, get credits?
« Reply #2 on: May 29, 2007, 04:14:03 pm »
That would be something like this...

On Register.php under sources...

Find this
// Registration options are always default options...

add this before that...
Code: [Select]
if($referrer > 0)
{
$query = db_query("SELECT * FROM {$db_prefix}settings", __FILE__, __LINE__);
$refural= mysql_fetch_assoc($query);
$ammountGiven = $refural['shopRegAmount']/2;
$query2 = db_query ("SELECT * FROM {$db_prefix}members WHERE ID_MEMBER = '$referrer'", __FILE__, __LINE__);
$result = mysql_fetch_assoc($query2);
$bank = $result['moneyBank'];
if ($ammountGiven == 0) $ammountGiven = 500;
$newBank= $bank+$ammountGiven;
$query = db_query ("UPDATE {$db_prefix}members
SET moneyBank = '$newBank'
WHERE ID_MEMBER = '$referrer'", __FILE__, __LINE__);
}

It will give half of the "Register amount Credits" or 500 if you don't have that set... should work... didn't get to fully test it. It will only give the credits if they register...

EDIT: it HAS been tested by me, and it does work.

EDIT 2: Ok, i forgot to make it do something... 1 moment b4 i get you the right code... (Forgot to make it convert some things...)
« Last Edit: May 30, 2007, 02:40:04 am by feildmaster »

Offline feildmaster

Re: Refer a friend, get credits?
« Reply #3 on: May 30, 2007, 03:10:22 am »
K, sorry for double posting but I would rather not edit my first post yet AGAIN...

Here is the CORRECT code... it gives half of the "Register Points" to the person who referred the guy, into his bank account, use the second code to give it to the persons pocket. And like before, if you don't use the register points they get 500 (or change the 500 to something else)

This code goes into Register.php above

Code: (Search For) [Select]
// Registration options are always default options...
Code: (Referrer gets credits to bank) [Select]
if($referrer > 0)
{
$query = db_query("SELECT value FROM {$db_prefix}settings WHERE variable = 'shopRegAmount'", __FILE__, __LINE__);
$refural= mysql_fetch_assoc($query);
$ammountGiven = $refural['value']/'2';
$query2 = db_query ("SELECT moneyBank FROM {$db_prefix}members WHERE ID_MEMBER = '$referrer'", __FILE__, __LINE__);
$result = mysql_fetch_assoc($query2);
$bank = $result['moneyBank'];
if ($ammountGiven == 0) $ammountGiven = 500;
$newBank= $bank+$ammountGiven;
$query = db_query ("UPDATE {$db_prefix}members
SET moneyBank = '$newBank'
WHERE ID_MEMBER = '$referrer'", __FILE__, __LINE__);
}

Code: (Referrer gets credits to pocket) [Select]
if($referrer > 0)
{
$query = db_query("SELECT value FROM {$db_prefix}settings WHERE variable = 'shopRegAmount'", __FILE__, __LINE__);
$refural= mysql_fetch_assoc($query);
$ammountGiven = $refural['value']/'2';
$query2 = db_query ("SELECT money FROM {$db_prefix}members WHERE ID_MEMBER = '$referrer'", __FILE__, __LINE__);
$result = mysql_fetch_assoc($query2);
$pocket = $result['money'];
if ($ammountGiven == 0) $ammountGiven = 500;
$newPocket= $pocket+$ammountGiven;
$query = db_query ("UPDATE {$db_prefix}members
SET money= '$newPocket'
WHERE ID_MEMBER = '$referrer'", __FILE__, __LINE__);
}

The above codes work 100% correctly... Tested by me, of course.
« Last Edit: May 30, 2007, 03:12:48 am by feildmaster »

Hendricius

  • Guest
Re: Refer a friend, get credits?
« Reply #4 on: May 31, 2007, 12:12:59 am »
Thank you,

1 Question:

Where is that referring Box?

http://www.d3scene.com/forum/index.php?action=register , is the URL for registering on my Forum.

Offline feildmaster

Re: Refer a friend, get credits?
« Reply #5 on: May 31, 2007, 01:56:59 am »
do you not know of the refferal mod...? I have it as an attachment. if you want it... Oo

it works as


http://www.d3scene.com/forum/index.php?action=register;refferal= (then the persons ID number goes here)

Offline Teun

Re: Refer a friend, get credits?
« Reply #6 on: June 24, 2007, 06:14:22 pm »
Woow thanks so much! I will definately use this!

Offline Rus

Re: Refer a friend, get credits?
« Reply #7 on: August 15, 2007, 02:40:03 am »
I cant seem to get this code to work.  I copied and pasted exactly what was here.

It showed that I was referred by test2 but test2 did not get any credits.

Did I miss something?

Offline Rus

Re: Refer a friend, get credits?
« Reply #8 on: August 15, 2007, 07:06:36 am »
So I posted in the SMF forum about rewarding for referals and the guy who wrote the mod said this which works perfectly and its a much tinier change.

Quote
  To give your users some money (for SMFSHOP) per referral

Open register.php (in sources)

FIND
Code:

// updateMemberData((int) $_POST['referredby'], array('karmaGood' => 'karmaGood + 25',));


REPLACE WITH
Code:

updateMemberData((int) $_POST['referredby'], array('money' => 'money + 100',));


Change the 100 to the amount of money you want to give them. 

Offline Teun

Re: Refer a friend, get credits?
« Reply #9 on: September 01, 2007, 07:36:37 pm »
Hi,

I see it's also possible to see how many hits the unique link had. Is it possible to give 1 Credit for each hit?

Thanks