PDA

View Full Version : PHP Code for Referral?


E
11-02-2002, 03:22 AM
I'd like to put referral count where [in everyones posts], it shows, next to post count, point system count, member ID# etc, referral count..

But I can't find the PHP code for it. May any one by chance find it or tell me it? Im sure many know it.

Example:
Offline Registered: Apr 2002
Local Time: 05:17 AM
Style: Dark Blue
Referrals: #


^ I would like to get that to work properly for each user.
If you do not understand & think you may be of help to me, please contact me on AIM: IFLoE2000

Thank You.

Erwin
11-02-2002, 08:38 AM
Not tested myself, but should work - try this:

In functions.php, find:


$post[off]=bbcodeparse($post[off],0,$allowsmilies);


UNDERNEATH, add:


// Get referrals
if ($usereferrer) {
$refcount = $DB_site->query_first("SELECT count(*) AS count
FROM user
WHERE referrerid = '$post[userid]'");
$referrals = $refcount[count];
}


Then, in your postbit, add this anywhere you like to show the referral count:


Referrals: #$referrals


Should work! However, this will add an extra query per post in a thread to the showthread page. There's no real way around this unfortunately, since the referral count needs a query to COUNT the variable from the database. :)

E
11-02-2002, 12:34 PM
ok, ill try it out as soon as possible. Thank You! :)