OK, try this..
Create a template called 'referrals' and put this code in it..
Code:
<vb:each from="referrals" value="referral">
, <a href="member.php?{vb:raw session.sessionurl}{vb:raw referral.userid}-{vb:raw referral.username}">{vb:raw referral.username}</a>
</vb:each>
What that boils down to in PHP is a...
Code:
foreach($referrals as $referral)
Then create a plugin using the 'forumhome_complete' hook with this code (don't do this on a live site)..
Code:
$referrals = $vbulletin->db->query_read("
SELECT username, userid
FROM " . TABLE_PREFIX . "user
WHERE referrerid = '".$userinfo['userid']."'
AND usergroupid NOT IN (3,4)
ORDER BY username
");
$ref = array();
$refkey = 0;
while ($referral = $vbulletin->db->fetch_array($referrals))
{
$ref[$refkey]['userid'] = $referral[userid];
$ref[$refkey]['username'] = $referral[username];
$refkey++;
}
$vbulletin->db->free_result($referrals);
$templater = vB_Template::create('referrals');
$templater->register('referrals', $ref);
print_output($templater->render());
The $vbulletin-> MAY or MAY NOT be needed. $db-> might be all you need.
That should output your comma separated list when you click the forum home link on the site. And, you should be able to blend that into whatever template, plugin or php code you need.
--------------- Added [DATE]1326135002[/DATE] at [TIME]1326135002[/TIME] ---------------
I still prefer to do the same thing in PHP with a "xxx_bits" template. Then include the raw info in my main template.
Because, as you can see, you parse the data into an array and then parse it a second time in the template.
Doing it my way with a 'xxx_bits' template, the data is only parsed once.