PDA

View Full Version : Referring hack addon - please help


gspot
12-13-2003, 10:37 PM
Ok, I'm trying to use a hack that was posted on this site and the only problem that I have ran into is the order in which the referrals are being shown on the main template page. Here is my code right now:


error_reporting(7);
$templatesused='reflistbit,reflist';
require('./global.php');
$max=4; //This number decides how many users to display
//show total number pending activation referrals
$referrers = $DB_site->query("SELECT COUNT(*) AS referrals, user.username, user.userid FROM user AS users LEFT JOIN user ON (users.referrerid = user.userid)
WHERE users.referrerid <> 0
GROUP BY users.referrerid
ORDER BY referrals DESC
LIMIT $max");
while ($referrer=$DB_site->fetch_array($referrers)) {
$referreds = $DB_site->query("SELECT username FROM user WHERE referrerid = '$referrer[userid]' AND user.usergroupid=2");
// AND user.usergroupid=2
while ($referred = $DB_site->fetch_array($referreds)){
if ($referrerlist) {
$referrerlist.=", $referred[username] ";
} else {
$referrerlist = "$referred[username]";
}
}
//end show actual numbers of pending activation referals
//show actual number of verified members
$referredstest = $DB_site->query("SELECT COUNT('username') AS username FROM user WHERE referrerid = '$referrer[userid]' AND user.usergroupid=2
ORDER BY username DESC");
// AND user.usergroupid=2
while ($referred11 = $DB_site->fetch_array($referredstest)){
if ($referreractual) {
$referreractual.=", $referred11[username] ";
} else {
$referreractual = "$referred11[username]";
}
//end actual # show
}
eval("\$reflistbits .= \"".gettemplate("reflistbit")."\";");
$referrerlist="";
$referreractual="";
}
eval("dooutput(\"".gettemplate("reflist")."\");");



*All the referrals are being listed in decending order by the complete number of referrals pending and not by the actual number of referrals activated... What can I do here?? Any help is greatly appreciated...

MindTrix
12-26-2003, 05:15 PM
Wouldnt you just change all the instances of DESC too ASC ?

gspot
12-27-2003, 10:29 PM
Ya, I tried that with no luck, but I finally got it to work.

Thanks for the reply though. Hopefully I will be adding it to the hack as an addon.