Jump to content

vmhosts_ge

Member
  • Posts

    4
  • Joined

  • Last visited

About vmhosts_ge

vmhosts_ge's Achievements

Junior Member

Junior Member (1/3)

0

Reputation

  1. Just when you're trying to get something done, work always seems to go crazy!! To be honest, I don't have a preference either way. Packaging it up would be a great help if you could please Mark
  2. 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?
  3. Hi Mark, Thanks for the detailed info there, that's really helpful and a great place for me to start. One part I can see myself getting stuck on however, is the query to store all admin users for the department the ticket is in, ready to send out emails to. I'm not sure if I need a conditional statement to filter the admin users if they're assigned to the department the ticket is in or not? I'm not even sure on what the correct syntax is to query admin users within WHMCS. Any ideas? Thanks in advance
  4. Afternoon All, First time poster here so apologies in advance if I miss anything. I have a requirement where I'd like other admin users to be notified when an admin of a department sends a reply to the customer. After speaking with WHMCS support they've pointed me in the direction of the following article https://developers.whmcs.com/hooks-reference/ticket/#ticketadminreply From what I understand, I would need to write a function using the sendadminemail API https://developers.whmcs.com/api-reference/sendadminemail/ and put that function into the hook above. I have a couple of questions, the first is, what file would you place the code in to execute this? I'm fairly rusty / not great at coding, I've had a go at writing what I would need based on the linked documentation but not sure if what I have is a good start, also not sure on what code would be required to pull the admin email addresses that are assigned to a specific department. So my second question is would you mind taking a look and helping me along the way? function Support_Admin_Reply_Notification_Function ($vars) { $command = 'SendAdminEmail'; $AdminUsers = get-adminUsers | where $vars['deptid'] ==; //No idea on this part $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']) foreach ($AdminUser in $AdminUsers) { $results = localAPI($command,$values,$AdminUser); logActivity($AdminUser . ' attempted to notify admins of reply to ticket #'.$vars['ticketid'].' '); } } add_hook(TicketAdminReply',1,'Support_Admin_Reply_Notification_Function'); Thank you in advance Gary
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated