Quote:
Originally Posted by kh99
The error you were getting is because the db object isn't defined, which usually is because $vbulletin isn't in scope. The new error is because you're missing a close quote on the query string. Try this:
PHP Code:
<?php
global $vbulletin;
$groupid = 43;
$users = $vbulletin->db->query_read("SELECT username FROM ".TABLE_PREFIX."user
WHERE usergroupid = $groupid OR FIND_IN_SET($groupid, membergroupids)";
$str = '';
$sep = '';
while ($user = $vbulletin->db->fetch_array($users))
{
$str .= $sep . $user['username'];
$sep = ', ';
}
// $str is comma separated list of users in $groupid
$vbulletin->db->free_result($users);
echo "Market Banned: $str";
?>
That assumes that what you posted is only part of a page (like it's included or it's plugin code or something). If you're trying to make a stand-alone page then you need to inlucde global.php. (If you are trying to make a page you might want to look at this: https://vborg.vbsupport.ru/showthread.php?t=228112).
|
I am just looking to have a page that displays those users so moderators can have it readily available if needed. I have created the template and page as shown in the tutorial you linked; however, I am not sure where to place the original code snipped you posted above as I cannot put it in the template itself. Would I need to create a plugin and include that in the template? If so, what hook do I need to use and what would I do?
Thanks