So, here is what I am thinking. I added the following to my .php code.
PHP Code:
$displaygroups = array();
$displaygroups = explode(',', $vbulletin->options['showroster_display_groups']);
$users = $db->query_read_slave("
SELECT user.*, usergroup.usergroupid, usergroup.title, user.options, usertextfield.*, userfield.*,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
FROM " . TABLE_PREFIX . "usergroup AS usergroup
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.usergroupid = usergroup.usergroupid OR FIND_IN_SET(usergroup.usergroupid, user.membergroupids))
LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)
LEFT JOIN " . TABLE_PREFIX . "customprofilepic AS customprofilepic ON (user.userid = customprofilepic.userid)
LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid=user.userid)
WHERE (user.usergroupid IN $displaygroups)
");
Obviously, that isn't working since $displaygroups isn't working in the query because it is an array. I'll keep researching and trying to figure something out. Hopefully someone will see my error here.
--------------- Added [DATE]1267129932[/DATE] at [TIME]1267129932[/TIME] ---------------
Okay, I just got another idea.
How about I create a new table called showroster and a field named displaygroups. How can I take the comma seperated numbers from my $vbulletin->options['showroster_display_groups'] field (from the options menu) and dump them into that table and field?
I think if I get that far, I could add a WHERE to the query to compare that with the user.usergroupid.
Perhaps: WHERE (user.usergroupid = showroster.displaygroups)
?