Jump to content

Signature E-mail Template


Marcell

Recommended Posts

Hello!

I would like to know if it is possible to use Conditional Displays with Signature.

Currently my signature is Marcell Csendes on the My Account page.


and I used this code in the Support Ticket E-mail template:

{if $signature eq "Marcell Csendes"} Marcell Csendes {else} BroHosting {/if} ● Customer Success

Shouldn't it work? I have no errors, I can only see BroHosting when getting a reply from a ticket. So have no idea what's wrong.

Link to comment
Share on other sites

Hi Marcell,

15 hours ago, Marcell said:

I would like to know if it is possible to use Conditional Displays with Signature.

yes.

15 hours ago, Marcell said:

Shouldn't it work? I have no errors, I can only see BroHosting when getting a reply from a ticket. So have no idea what's wrong.

it should work - and certainly does for me on a v7.4RC1 dev - and i've no reason to think it wouldn't work on earlier versions...

2nXvG3L.png

the above/below is from the ticked opened template, but it works in the reply template too. :idea:

<p>{$client_name},</p>
<p>Thank you for contacting our support team. A support ticket has now been opened for your request. You will be notified when a response is made by email. The details of your ticket are shown below.</p>
<p>Subject: {$ticket_subject}<br /> Priority: {$ticket_priority}<br /> Status: {$ticket_status}</p>
<p>You can view the ticket at any time at {$ticket_link}</p>
<p>{$signature}<br /><br /></p>
{if $signature eq "Marcell Csendes"} Marcell Csendes {else} BroHosting {/if} ● Customer Success

if you click on the HTML button dUHjlVV.png and view the HTML source of the template, can you see if WHMCS has added any additional code to the Smarty statement ? if so, just delete that code and add the {if} statement again while in the HTML source window and everything should be ok.

btw - ignore that i've got both {$signature} and your {if} statement in my code above, I just wanted to check both were working (as the ticket reply template didn't already have a $signature tag in it by default).

Link to comment
Share on other sites

Oh ok :)

The problem is, this is defined earlier as the signature, so I think, that's the problem.

See my example: 

http://prntscr.com/h7repf

Ok, tried your version, but seems that's even worse because the signature you inserting is a global one. While I want to use my Per Staff Signature. (personal)


In this case, I still see BroHosting, I just want to insert the staff name here and I thought this alternative way with the signature. Do you have any idea other than PreSend? 

Edited by Marcell
Link to comment
Share on other sites

20 minutes ago, Marcell said:

@brian! Any idea?

you could do it with a template edit to /admin/templates/blend/viewticket.tpl by adding the following to the beginning of the template...

{if $signature neq "Marcell Csendes"}
   {assign signature "BroHosting"}
{/if}

this will change the value of $signature to "BroHosting" if it doesn't currently match "Marcell Csendes" - of course, your staff could still edit it if they want to.

https://docs.whmcs.com/Support_Tickets

Quote

If a Support Ticket Signature is configured in your admin profile, it will be pre-populated into this field.

so all this code is doing is changing that pre-population value.

61gpvkp.png

the email {$signature} is a different beast and uses the Global Email Signature value.

https://docs.whmcs.com/Mail_Tab#Global_Email_Signature

Quote

Enter the text to be appended to all emails sent to customers by WHMCS containing the {$signature} merge field. HTML can be used here.

if you wanted to use support ticket signatures instead, then I think you're looking at the presend hook, because the email template doesn't contain any information that identifies the member of staff replying (if it did, then you could use Smarty).

Link to comment
Share on other sites

21 hours ago, Marcell said:

I don't know presend sadly, so doubt this will ever work. .(

coming at this from another angle, is there any reason why you can't just tell your support staff to change their support ticket signatures to "BroHosting" ?? surely, that would solve the issue without the need for any hooks or template changes. :idea:

Link to comment
Share on other sites

25 minutes ago, brian! said:

coming at this from another angle, is there any reason why you can't just tell your support staff to change their support ticket signatures to "BroHosting" ?? surely, that would solve the issue without the need for any hooks or template changes. :idea:


Look, I just want to display this way my template when ANY STAFF reply by example a ticket or start a new one:

http://prntscr.com/h8rytt

See the screenshot, hope you now understand, what I really mean is to just display the right picture and name depending who sent the ticket (according to the signature as I can't get who really sent the ticket /no staff merge field exist, so thought this alternative would work/)

Link to comment
Share on other sites

1 hour ago, Marcell said:

what I really mean is to just display the right picture and name depending who sent the ticket (according to the signature as I can't get who really sent the ticket /no staff merge field exist, so thought this alternative would work/)

it could work... but without resorting to hooks, i'm not sure you could do it 100% guaranteed.

if you want to do this in the template, then instead of seeing if a signature mergefield equals 'x', you can check if the entire {$ticket_message} field contains 'x'...

{if $ticket_message|strstr:'Marcell Csendes'}show marcell photo{elseif $ticket_message|strstr:'brian!'}show brian photo{else}show generic photo{/if}

... but the problem with that is it will search the entire string, so if I mention your full name in the support ticket, then it will find that first - not good.

so if we just check the end of the string, say the last 20 characters (adjust if you have staff with longer names than that) and search that, we have a much higher probability of getting the correct value.

{if $ticket_message|substr:-20|strstr:'Marcell Csendes'}show marcell photo{elseif $ticket_message|substr:-20|strstr:'brian!'}show brian photo{else}show generic photo{/if}

i've quickly tested this in v7.2.3 and it will work, but if you're intending to do this on any v7 installation, there is one very important step to remember - Smarty Security Policy - basically a lot of PHP functions/modifiers are disabled by default in WHMCS and in order to use them in email templates like this, you will have to enable them in the security policy.. strstr and substr are both modifiers.

if you do not modify the security policy, the above idea will not work (there won't be a visual error message, but it will tell you in the activity log) - if you do, it will. :idea:

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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