Hi Mark,
Thanks for this, what I have so far is:
hooks.php
function Support_Admin_Reply_Notification_Function ($vars) {
$command = 'SendAdminEmail';
$values ['mergefields'] = array(
'messagename' => 'Admin Ticket Reply',
'ticket_id' => $vars['ticketid'],
'ticket_department' => $vars['deptname'],
'ticket_subject' => $vars['subject'],
'ticket_priority' => $vars['priority'],
'ticket_message' => nl2br($vars['message']),
'type' => 'support',
'deptid' => $vars['deptid'])
// I think we could even filter this somehow using eloquent, but this is how you get them all!
foreach (\WHMCS\User\Admin::all() as $admin) {
if (in_array($vars["deptid"], $admin->supportDepartmentIds)) {
// Woah! lets send an email or something:-D
$results = localAPI($command,$values,$AdminUser);
logActivity($AdminUser . ' attempted to notify admins of reply to ticket #'.$vars['ticketid'].' ');
$id = $admin->id; // all columns are here now
}
}
}
add_hook(TicketAdminReply',1,'Support_Admin_Reply_Notification_Function');
AdminNotifications.php
<?php
AdminNotifications_config() {
$info = [
"name" => "Admin Notifications",
"description" => "Send Notifications to other admins when an Admin replies to a support ticket",
"version" => "1.0",
"author" => "Gary"
];
return $info;
}
I noticed that at the befinning of the main module file you opened with <?php do I therefore need to close that somewhere within the module?