Jump to content

Editting POP Email Replies Hook?


DRyan

Recommended Posts

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

  • 2 months later...

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

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

  • 1 year later...
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

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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