Support

Home Forums Event Espresso Premium Help with customizing message for Outlook – conditional tags

Help with customizing message for Outlook – conditional tags

Posted: March 1, 2019 at 3:56 pm


lisa burgess

March 1, 2019 at 3:56 pm

Hi,

A while back someone experienced the same issue I’m currently having trying to customize message templates so they render properly in Outlook. Unfortunately, the majority of my client’s customers use Outlook – so I need a way to make the emails look presentable using Outlook.

the original thread is: https://eventespresso.com/topic/email-template-conditional-tags-support/

In there you provided a code snippet: https://gist.github.com/Pebblo/e03fe3a4fe02c2803a8786e63b8d6978

The issue I’m having is that the errors I’m receiving are not in the “Event_List” field as the original support thread, mine are found in “Main Content” field. So my error message looks like this when I try to save the message:

The following shortcodes were found in the “Main Content” field that ARE not valid: [class=body],[class=body],[class=body],[class=body],[class=body],[class=body],[class=body],[class=body],[class=body],[class=body],[class=body],[class=body],[class=body],[class=body],[class=body]

How would I update that code snippet to reflect this?

Many thanks in advance for your help!
Lisa Burgess


Tony

  • Support Staff

March 4, 2019 at 3:31 am

Hi Lisa,

That snippet adds 3 shortcodes to the messaging system, those are:

[if gte mso 9]
[endif]
[if mso]

The shortcode that is being rejected on your site is [class=body] which obviously isn’t one of the above, so have you add that shortcode to the snippet?

May I ask how you are using that shortcode and what you are expecting it to output?

If you can add a list of shortcodes you need here I can add them to the above snippet.


lisa burgess

March 4, 2019 at 5:26 am

Hi Tony,

Yes, I replaced the 3 snippets with my one shortcode [class=body]. However, the issue I’m running into is defining the section I want this shortcode to work in. Note the error I’m getting:

The following shortcodes were found in the “Main Content” field that ARE not valid: [class=body]

Right now, it looks like that starts on line 6 of that code snippet. I am using the “Main Content” area (the area where the default template is), but that is not one of the sections defined. How would I add that?

thanks,
lisa


Tony

  • Support Staff

March 4, 2019 at 6:39 am

Yes, I understand the problem, however, sections use specific shortcodes types depending on the details they have available to them and the ‘Main Content’ section would allow the shortcode if it was defined as part of EE_Event_Shortcodes, EE_Registration_Shortcodes or EE_Transaction_Shortcodes. Meaning if you added the shortcode to my snippet above correctly it would show up and be useable in the main content section, see: https://monosnap.com/file/3AgAPcyqmdXR9W8ZpmdMD8XYJLehj2

Can you post the code you are using on the site so I can take a look?


lisa burgess

March 4, 2019 at 6:45 am

function tw_ee_register_template_shortcodes( $shortcodes, EE_Shortcodes $lib ) {

//Which sections of the messages system do we add the shrotcodes.
if ( $lib instanceof EE_Datetime_Shortcodes || 
$lib instanceof EE_Event_Shortcodes || 
$lib instanceof EE_Registration_Shortcodes ||
$lib instanceof EE_Transaction_Shortcodes ||
$lib instanceof EE_Attendee_List_Shortcodes ||
$lib instanceof EE_Ticket_List_Shortcodes
) 
{
//Add custom shortcodes here.
//The shortcode is the key, the 'help text' is the shortcodes value.
$shortcodes['[body=class]'] = _('IOE Customization');
}
//Return the shortcodes.
return $shortcodes;
}
add_filter( 'FHEE__EE_Shortcodes__shortcodes', 'tw_ee_register_template_shortcodes', 10, 2 );
function tw_ee_parse_template_shortcodes( $parsed, $shortcode, $data, $extra_data, EE_Shortcodes $lib ) {
if ( $shortcode == '[body=class]' ) {	
return '[body=class]';
}
return $parsed;
}
add_filter( 'FHEE__EE_Shortcodes__parser_after', 'tw_ee_parse_template_shortcodes', 10, 5 );


Tony

  • Support Staff

March 4, 2019 at 6:48 am

Thank you, which message type are you editing currently?

If you click on the icon I highlighted in my screenshot, is the shortcode listed there?


lisa burgess

March 4, 2019 at 7:07 am

Hi Tony,
Yes, it is. omg, I just noticed that our programmer entered the syntax in reverse! [body=class] instead of [class=body]

Hopefully fixing this will solve the issue! Thanks for your help!!!
Lisa


Tony

  • Support Staff

March 4, 2019 at 7:30 am

Yeah, nice catch.

Here’s another option which may come in useful if you need multiple custom shortcodes to be output as ‘shortcode’, ie [test]

See this change which adds a [CUSTOM_SHORTCODE_*] shortcode to the messages.

This code parses the shortcode.

So for the above, you could use: [CUSTOM_SHORTCODE_*body=class]

It’s a little more flexible but as it stands can only be used to output [{custom_text}]

The support post ‘Help with customizing message for Outlook – conditional tags’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Tony 2 months, 3 weeks ago ago

Topic Tags

Tagged: 

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!