View Full Version : Display a list of users in a usergroup under a forum?
patracy
02-05-2014, 01:58 AM
Anyone have an idea of how to make this work?
I'd like to take the vendor usergroup we have (id:20) and have a forum display setup to list their usernames in a list (with hyperlinks to their profiles) as a forum.
I don't know what you mean when you say "as a forum". But maybe a roster mod, like this one: https://vborg.vbsupport.ru/showthread.php?t=299659 . I haven't tried it myself, and you might want to look at others by searching vb4 mod titles for "roster".
patracy
02-06-2014, 01:54 PM
Nahh, not really what I'm looking for. I'd like to simply display under a forum place holder a list of names with the names being hyperlinks to their profiles. Not really wanting another page to display. I assume that there's something that could be leveraged from the canned vB file showgroups.php since they display there. Just really would like to trim it down to either a single page that would display only the vendor usergroup (not the admin/mods) or a simple listing of user names on the main page, which is really what I'm aiming for.
Well, you could try creating a plugin using hook location forumdisplay_complete and code like this (change the X on the first line to the id of the forum where you want it to display):
if ($forumid == X)
{
if ($result = $vbulletin->db->query_read_slave("SELECT * FROM " . TABLE_PREFIX . "user WHERE usergroupid=20 ORDER BY username"))
{
while ($user = $vbulletin->db->fetch_array($result))
{
$members[] = $user;
}
$template = vB_Template::create('my_memberlist');
$template->register('members', $members);
$template_hook['forumdisplay_below_threadlist'] .= $template->render();
}
}
then create a new template something like this:
Members:<br /><br />
<vb:each from="members" key="key" value="member">
<a href="{vb:link member, {vb:raw member}}">{vb:var member.username}</a><br />
</vb:each>
<br/><br/>
In this example I named the new template 'my_memberlist', but you can name it anything you want as long as you change it in the plugin code as well.
Of course this is a simple example, html isn't really my thing so I'll leave it up to you to make it look good.
patracy
02-13-2014, 08:48 PM
Hmm, so I did all this, but all I see is the newly formed forum, but no listing. Is there something I should do in how the forum is setup? Maybe insert some code into the link?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.