Kevin K Posted January 9, 2017 Share Posted January 9, 2017 I have this hook that was working for years, but now that I upgraded to 7.1, it is no longer working. This hook emails all staff on support staff replies. I have tried changing several things, with no luck. The email is not being sent to all staff members like it should be. I keep getting the error: [result] => error [message] => Email Template not found ) ; I was hoping someone could point out what might be wrong. The hook: if (!defined('WHMCS')) die('This file cannot be accessed directly'); // Convert ticket id to tid function id_to_tid($id) { $table = "tbltickets"; $fields = "tid"; $where = array("id"=>$id); $result = select_query($table,$fields,$where); $data = mysql_fetch_array($result); return $data['tid']; } function admin_reply_notification_hook_admin_reply($vars) { $command = 'sendadminemail'; $adminuser = 'admin'; $values['messagename'] = 'Support Ticket Response'; $values['mergefields'] = array( 'ticket_id' => $vars['ticketid'], 'ticket_tid' => id_to_tid($vars['ticketid']), 'admin' => $vars['admin'], 'ticket_department' => $vars['deptname'], 'ticket_subject' => $vars['subject'], 'ticket_priority' => $vars['priority'], 'ticket_message' => nl2br($vars['message'])); $values['type'] = 'support'; $values['deptid'] = $vars['deptid']; $results = localAPI($command,$values,$adminuser); logActivity($vars['admin'] . ' attempted to notify admins of reply to ticket #'.$vars['ticketid'].' '); } add_hook('TicketAdminReply',1,'admin_reply_notification_hook_admin_reply'); The Activity Error Log: (I replaced some of the output to protect details. All info is correct though in the output) "Staff Memeber Name" attempted to notify admins of reply to ticket #11111; result: Array ( [result] => error [message] => Email Template not found ) ; values: Array ( [messagename] => Support Ticket Response [mergefields] => Array ( [ticket_id] => 11111 [ticket_tid] => 1111111 [admin] => "Staff Memeber Name" [ticket_department] => Billing [ticket_subject] => test [ticket_priority] => Medium [ticket_message] => Hello Client, <br /> <br /> test123 ) [type] => support [deptid] => 3 ) 0 Quote Link to comment Share on other sites More sharing options...
twhiting9275 Posted January 9, 2017 Share Posted January 9, 2017 Is the template in a 'custom' template group? try moving it into one of the standard ones if it is. I found this myself with 7.0. 0 Quote Link to comment Share on other sites More sharing options...
Kevin K Posted January 9, 2017 Author Share Posted January 9, 2017 Well it should be using the support ticket reply email template. I tried changing the messagename variable to Support Ticket Reply and it had no affect. 0 Quote Link to comment Share on other sites More sharing options...
Saravanan Posted June 30, 2017 Share Posted June 30, 2017 Me to have same problem .. WHMCS 7.1 , TicketUserReply , TicketOpen hooks are working correctly , but TicketAdminReply not called when admin or support operator reply the ticket 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.