View Full Version : How to find member that have referred most users.
nirvana43
10-08-2009, 08:56 AM
May i know how to find member that have referred the most members.
Is there any code snippet available for this??
Like, if i want to display a top referrer (or find his uid/uname whatever), on custom page? how do i find that? :)
Brother Malachi
10-08-2009, 04:19 PM
I guess you can run a query, grab all the users whose referid isn't empty, then sort it through an array.
$users_rep_query = $db->query_read("SELECT referrerid FROM " . TABLE_PREFIX . "user WHERE referrerid IS NOT NULL");
$users_rep_sort = array();
while ( $users_rep_array = $vbulletin->db->fetch_array($users_rep_query) ) {
$users_rep_sort[$users_rep_array['referrerid']]++;
}
arsort($users_rep_sort);
The above will give you an array with userID's, sorted by # of referrals.
You just need to take the userID and convert it to a username.
Brandon Sheley
10-08-2009, 05:06 PM
There are several stats mods that will show this, there is also a referral mod (http://forum.vbulletinsetup.com/referrers.php) if this is all you want to see.
tbrown7552
10-08-2009, 06:08 PM
<a href="http://www.yoursitehere.com/forum/admincp/usertools.php?do=referrers" target="_blank">http://www.yoursitehere.com/forum/ad...p?do=referrers</a>
nirvana43
10-09-2009, 03:24 AM
Thanks a million guyes for help..
@Loco.M, yap thats exactly what i was looking for.
Referrer Stats..
Thanks a million
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.