According to this page this is the list of special tags that Hesk will replace before sending an email:
https://www.hesk.com/knowledgebase/index.php?article=35
SPECIAL TAG WILL BE REPLACED WITH
%%NAME%% customer name
%%EMAIL%% customer email (since version 2.5.0)
%%SUBJECT%% ticket subject
%%MESSAGE%% ticket (reply) message
%%CREATED%% date and time of ticket submission
%%UPDATED%% date and time of ticket last update
%%TRACK_ID%% ticket tracking ID
%%TRACK_URL%% ticket URL address
%%SITE_TITLE%% your website title
%%SITE_URL%% your website URL address
%%CATEGORY%% ticket category
%%OWNER%% staff member assigned to the ticket
%%PRIORITY%% ticket priority
%%STATUS%% ticket status
%%ID%% sequential ticket ID
%%CUSTOM1%%
...
%%CUSTOM20%% value of custom field 1 (or custom field 20 in the second case).
Is there a special tag that shows the full thread of a ticket with all previous replies ?
Hesk
Moderator: mkoch227
Re: Hesk
Unfortunately no, there is no such option in Hesk.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
-
- Posts: 2
- Joined: Mon Oct 28, 2024 4:06 pm
Re: Hesk
Hiya!
I was able to get ticket history to display on my instance by adding the below code to \inc\email_functions.inc.php, then adding the special tag %%PREVIOUSREPLIES%% to the bottom of my e-mail templates.
I have my instance setup to strip quoted replies, which I believe is necessary in order to show only one reply at a time in the ticket history.
Below is the code I added -
You'll want to add it below the following code block:
Let me know if that works for you!
I was able to get ticket history to display on my instance by adding the below code to \inc\email_functions.inc.php, then adding the special tag %%PREVIOUSREPLIES%% to the bottom of my e-mail templates.
I have my instance setup to strip quoted replies, which I believe is necessary in order to show only one reply at a time in the ticket history.
Below is the code I added -
Code: Select all
// Add %%PREVIOUSREPLIES%% ##heskmod
// Fetch previous replies format
$prevreply_res = hesk_dbQuery("SELECT `message` , `dt` , `name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."replies` WHERE `replyto` = '".intval($ticket['id'])."' ORDER BY `id` DESC");
// Initialize variable for previous replies
$previous_replies = "";
// Loop through each reply and append it to previous reply variable
//
while ($reply = hesk_dbFetchAssoc($prevreply_res)) {
// Decode HTML entities to render correctly in the email
$previous_replies .= "on " . $reply['dt'] . " -- " . $reply['name'] . " wrote" . "<hr>" . $reply['message'] . "<hr>";
}
// attempt to properly format HTML again
$replychain = hesk_html_entity_decode ($previous_replies);
// Replace %%PREVIOUSREPLIES%% with the retrieved replies
// list ($msg, $html_msg) = hesk_replace_email_tag ('%%PREVIOUSREPLIES%%', $replychain, $msg, $html_msg);
$msg = str_replace ('%%PREVIOUSREPLIES%%', $replychain, $msg);
$html_msg = str_replace ('%%PREVIOUSREPLIES%%', $replychain, $html_msg);
//$msg = str_replace('%%PREVIOUSREPLIES%%', $previous_replies, $msg);
// End %%PREVIOUSREPLIES%% ##heskmod
Code: Select all
// Is message tag in email template?
if (strpos($msg, '%%MESSAGE%%') !== false || strpos($html_msg, '%%MESSAGE%%') !== false) {
// If there are attachments to this email and the %%ATTACHMENTS%% tag was not present, add links to attachments below the message
if ($hesk_settings['attachments']['use'] && isset($ticket['attachments']) && strlen($ticket['attachments'])) {
if ($count_plain == 0) {
$ticket['message'] .= "\n\n" . $hesklang['fatt'] . "\n\n" . $att_links;
}
if ($count_html == 0) {
$ticket['message_html'] .= "<br/><br/>" . $hesklang['fatt'] . "<br/>" . $html_att_links;
}
}
// Replace message
$msg = str_replace('%%MESSAGE%%', $ticket['message'], $msg);
$html_msg = str_replace('%%MESSAGE%%', $ticket['message_html'], $html_msg);
// For customer notifications: if we allow email piping/pop 3 fetching and
// stripping quoted replies add an "reply above this line" tag
if (!$is_admin && ($hesk_settings['email_piping'] || $hesk_settings['pop3'] || $hesk_settings['imap']) && $hesk_settings['strip_quoted']) {
$msg = $hesklang['EMAIL_HR'] . "\n\n" . $msg;
$html_msg = $hesklang['EMAIL_HR'] . '<br/><br/>' . $html_msg;
}
}
// Add %%PREVIOUSREPLIES%% ##heskmod <---------- Insert code here
Re: Hesk
Thank you for sharing your solution!
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
-
- Posts: 2
- Joined: Mon Oct 28, 2024 4:06 pm
Re: Hesk
Absolutely! Thanks for making this awesome software, Klemen!