DRyan Posted September 10, 2016 Share Posted September 10, 2016 Hi, How do you get to edit the global variable to the email replies before it get imported to the whmcs ticket? I tried using Hooks:TransliterateTicketText or Hooks:TicketUserReply to edit but it doesn't quite do anything. // Filter the email ticket reply before importing to WHMCS database add_hook('Hooks:TicketUserReply', 1, function ($vars) { $reply_message = $vars['message']; $message = stristr($reply_message, '----reply above this line----', true); return $message; }); Link to comment Share on other sites More sharing options...
aggrosoft Posted December 7, 2016 Share Posted December 7, 2016 Got exactly the same question? How is this supposed to work? Link to comment Share on other sites More sharing options...
pablobaldovi Posted December 7, 2016 Share Posted December 7, 2016 sorry, I can't understand what you want to do Link to comment Share on other sites More sharing options...
aggrosoft Posted December 7, 2016 Share Posted December 7, 2016 This hook at http://docs.whmcs.com/Hooks:TransliterateTicketText is meant to be used to modify the ticket message before it is imported into whmcs when the user replies by email. The Hook description says "The global variables subject and message can be accessed and edited if required." This is not working, the hook does not allow a return value and also the variables are not global at all. Link to comment Share on other sites More sharing options...
pablobaldovi Posted December 9, 2016 Share Posted December 9, 2016 Hi. First of all, I could not make it work. And I sent a support ticket to WHMCS. The correct way to modify global variables is: A) making use of the $ GLOBALS array, in this case would be, $ GLOBALS ['subject'] and $ GLOBALS ['message'] B) Declaring the variable as GLOBAL within the function, ie within the hook declare GLOBAL $ subject and GLOBAL $ message I tried and can access the variables in the 2 ways but when changing the content both the pipped ticket and the email sent remain unchanged. I wait for the support response. Link to comment Share on other sites More sharing options...
omar.fathy13 Posted January 8, 2018 Share Posted January 8, 2018 On ٩/١٢/٢٠١٦ at 1:38 PM, pablobaldovi said: Hi. First of all, I could not make it work. And I sent a support ticket to WHMCS. The correct way to modify global variables is: A) making use of the $ GLOBALS array, in this case would be, $ GLOBALS ['subject'] and $ GLOBALS ['message'] B) Declaring the variable as GLOBAL within the function, ie within the hook declare GLOBAL $ subject and GLOBAL $ message I tried and can access the variables in the 2 ways but when changing the content both the pipped ticket and the email sent remain unchanged. I wait for the support response. I have the same problem $GLOBALS['message'] or global $message; not change message like function f(){ $message = "kkkk"; call_user_func('fd',['message'=> $message ]); echo $message; } function fd($var){ /* not work global $message; $message = "mmmm"; */ /* not work $GLOBALS['message'] = "mmmm"; */ // not work $var['message'] = "mmmm"; return $var; } f(); output : "kkkk" Link to comment Share on other sites More sharing options...
Recommended Posts