referal links

Started by umiya, January 19, 2005, 09:41:43 PM

Previous topic - Next topic

dtm.exe

Quote from: Kirby on January 19, 2005, 09:44:23 PM
doesnt vBulletin have something like that?

They do, and it works like a charm :).

-Dan The Man

3guk

Would love to see this mod :)

Kirby

#22
Open: Sources/Register.php

Look for:

// Register them into the database.
db_query("
INSERT INTO {$db_prefix}members
(" . implode(', ', array_keys($register_vars)) . ")
VALUES (" . implode(', ', $register_vars) . ')', __FILE__, __LINE__);
$memberID = db_insert_id();
updateStats('member');


add after:

// Handle referrals seperately.
if (!empty($_POST['referrals']))
{
$referrals = explode(',', $_POST['referrals']);
// Make sure there are no doubles!
$referrals = array_unique($referrals);
foreach ($referrals as $referral)
{
// Find and do this member seperately..
$request = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE memberName = '$referral'
AND ID_MEMBER != $memberID", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
db_query("
UPDATE {$db_prefix}members
SET referrals = referrals + 1
WHERE ID_MEMBER = $row[ID_MEMBER]", __FILE__, __LINE__);
}
}


Open: Themes/default/Register.template.php

Look for:

<tr>
<td width="40%">
<b>', $txt[82], ':</b>
</td>
<td>
<input type="password" name="passwrd2" size="30" />
</td>
</tr>


add after:
<tr>
<td width="40%">
<b>Referrals:<div class="smalltext">Optional; Seperate multiple names with commas</div></b>
</td>
<td>
<input type="text" name="referrals" size="60" />
</td>
</tr>


Open: Themes/default/Profile.template.php
Look for:

elseif ($modSettings['karmaMode'] == '2')
echo '
<tr>
<td>
<b>', $modSettings['karmaLabel'], ' </b>
</td><td>
+', $context['member']['karma']['good'], '/-', $context['member']['karma']['bad'], '
</td>
</tr>';
echo '


add after:

<tr>
<td><b>Referrals: </b></td>
<td>', $context['member']['referrals'], '</td>
</tr>


FINALLY, run this query:

ALTER TABLE {yourdbprefix}members ADD referrals smallint(5) NOT NULL AFTER karmaGood

3guk

Excuse me for being stupid but where does each member get thier individual links ?

If this works you are a god !!

edi67

i done this mod and all seem ok but i cannot see in user profile the name of the referals please explain me how i can see this ..

and for me too you will be a god  :P
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Kirby

Quote from: 3guk on June 02, 2005, 10:53:13 PM
Excuse me for being stupid but where does each member get thier individual links ?
Can you rephrase that?

Quotei done this mod and all seem ok but i cannot see in user profile the name of the referals please explain me how i can see this ..
The mod only logs the number of referrals :P

edi67

#26
QuoteThe mod only logs the number of referrals :P

please i need to see name of referals in profile of new user

is possible ?? please i need to know which user made invitation in my forum
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Kirby

it is, but at the moment the mod only logs the number..ill work on it when i have time

Kirby

#28
bleh, stupid me...you need to add this too..
open Load.php

look for:

mem.memberIP, mem.location, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.posts, mem.lastLogin, mem.karmaGood


add after:
, mem.referrals,

You will need to do it twice..
then look for:

'karma' => array(
'good' => &$profile['karmaGood'],
'bad' => &$profile['karmaBad'],
'allow' => !$user_info['is_guest'] && $user_info['posts'] >= $modSettings['karmaMinPosts'] && allowedTo('karma_edit') && !empty($modSettings['karmaMode']) && $ID_MEMBER != $user
),


and add after:

'referrals' => empty($profile['referrals']) ? 0 : $profile['referrals'],


i've also done a fix in the register.php part, be sure to fix it!

dtm.exe

Quote from: ??? on June 03, 2005, 04:19:50 PM
Quote from: 3guk on June 02, 2005, 10:53:13 PM
Excuse me for being stupid but where does each member get thier individual links ?
Can you rephrase that?

What 3guk is trying to ask is if members will have referral IDs such as yoursite.com/index.php?referrer=12345.

-Dan The Man

Kirby


dtm.exe

Quote from: ??? on June 03, 2005, 10:37:00 PM
hm no, thats not in

Could that be implemented?

-Dan The Man

code

i really need this mod :D
Far more than just another brick in the wall..

edi67

pity but not work for me nothing appear i need mod for referal registering in forum and see in profile of new user the referal user that invited to register in my forum

thanxk anyway kirby
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Kirby

Quote from: OIDanTheManIO on June 03, 2005, 11:53:10 PM
Quote from: ??? on June 03, 2005, 10:37:00 PM
hm no, thats not in

Could that be implemented?

-Dan The Man
when i get the time (i dont have much right now), ill add a whole bunch of new stuff and upload it to the mod site

misscalais

I have seen this in use at other forums as a reward system for members whereas they get bonus things such as choosing there own avatar for say 20 referrals then they get to be in a select group of members for 50+ referrals etc etc

I could see this as being beneficial to domain/hosting sellers in that for every 50 (example)successful referrals made by a member to the forums then that member could get a domain registered for free as a reward or reduced price hosting. the list could go on and on if u wanted to offer a rewards system for referrals!

Bring it on I say lol

cheers



umiya

still would liek to see this happen

tyademosu

 I am trying to implement the referral code on smf.  It's in place but it doesn't seem to be incrementing i.e the referral field is staying at 0.  Help.  Thanks

Ride

I also get the following error in the forum error log:   (this is on my test server)

8: Undefined index: referrals
File: C:\Program Files\Apache Group\Apache2\htdocs\forum\Themes\default\Profile.template.php (eval?)
Line: 150


And of course line 150 has this code:
<tr>
<td><b>Referrals: </b></td>
<td>', $context['member']['referrals'], '</td>
</tr>
<tr>

Ride

Stupid me had the settings pointing to another forum's source files on my test server.  I'm retarded.


There is one little "bug" if you want to call it that.  A user can register fake accounts to boost their (or a friends, etc.) referral number.  The referral credit is given before the registration is activated.  Would this be something easy to adjust for in the code?  Thanks.

Advertisement: