Following is the code needed to allow a PM to the appropriate members of the staff when the member comes back and replies to their trouble ticket! It is working on my site!
Before:
Code:
// ### NOT PREVIEW - ACTUAL POST ###
if ($vbulletin->GPC['ajax'])
{
Add:
PHP Code:
// check if it should send a private message to staff
if ($threadinfo['postuserid'] == $vbulletin->userinfo['userid'])
{
// build the $linkurl
$touser['repliedby'] = $vbulletin->userinfo['username'];
$linkurl = "/vbsupport.php?do=viewthread&tid=" . $threadinfo['threadid'];
$threadid = $threadinfo['threadid'];
$getthreadids = $vbulletin->db->query_read("
SELECT categoryid
FROM " . TABLE_PREFIX . "vbs_ticket_thread AS thread
WHERE threadid = $threadid
LIMIT 1
");
while ($thread = $vbulletin->db->fetch_array($getthreadids))
{
$categoryid = $thread['categoryid'];
}
// build the $emailids
$pmids = explode(',', $vbulletin->vbs_category["$categoryid"]['adminpmusers']);
$emailids = explode(',', $vbulletin->vbs_category["$categoryid"]['adminemailusers']);
// check for PM notifications
if (is_array($pmids))
{
// process add admins
foreach($vbulletin->vbs_admin AS $userid => $user)
{
// fetch the $userinfo for this user
$touser = fetch_userinfo($userid);
// build the $linkurl
$touser['repliedby'] = $vbulletin->userinfo['username'];
$linkurl = "/vbsupport.php?do=viewthread&tid=" . $threadid;
// check if it should send a pm
if (in_array($userid, $pmids))
{
// send a private message to the staff
$pmtitle = construct_phrase($vbphrase['vbsupport_pm_update_title'], $vbphrase['vbsupport_title'], $vbphrase['vbsupport_ticket'], $threadinfo['title']);
$pmtext = construct_phrase($vbphrase['vbsupport_pm_update_message'], $vbulletin->userinfo['username'], $vbulletin->options['bburl'] . $linkurl, $vbulletin->options['bbtitle']);
vbsupport_send_pm(0, $touser, $pmtitle, $pmtext);
}
}
}
}
There may well be a better way to code this but it works on my site now... This took a lot of time for me to figure out... WOW! Also note I ONLY coded PMs as that is all I am using on my site!