How about something like this
PHP Code:
$ids = array();
foreach ($vbulletin->usergroupcache as $usergroupid => $usergroup) {
if ($usergroupid == 6 or $usergroup['issupport']) {
$ids[] = $usergroupid;
}
}
if ($ids = implode(', ', $ids)) {
$result = $vbulletin->db->query_read("
SELECT userid
, username
, email
FROM " . TABLE_PREFIX . "user
WHERE usergroupid IN ($ids)
ORDER
BY username
");
while ($user = $vbulletin->db->fetch_array($result)) {
vbmail(
$user['email'],
sprintf('%s New Ticket Created', $vbulletin->options['bbtitle']),
sprintf(
'A new ticket has been created. Please visit the link below to
view the ticket.<br />Ticket: %s/%s/?do=ticket&id=%d',
$vbulletin->options['bburl'],
$support_file,
$ticketid
)
);
}
}