Add event_excerpt to a confirmation mail

WordPress Event Management, Calendars & Registration Forums General Question Add event_excerpt to a confirmation mail

This topic contains 2 replies, has 2 voices, and was last updated by  Alex Hofstra 7 years, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #23264

    Hi Stephen,

    I am sorry I am bothering you again. We need to sent some event depending information to the attendees with the confirmation email (or booking_confirmation email)
    First I wanted to use custom fields for this but that is (for me) much too complicated. Than I found the place holder tag %event_excerpt% and my thoughts were as follows: if we add the additional information to the excerpt of a event we can add it to the confirmation email.
    I tried to add this to the confirmation email but it doesn’t work. Within the email it is not recgocnized as a field you can add to the email like %event_date% or %event_venue% .

    Is it possible to add the excerpt to the confirmation email or do I need to approach it differently? Suggestions?

    Thank you for your reply!

    Alex Hofstra
    #23269

    Hi Alex,

    There’s a tutorial on how to register custom e-mail tags. The following should do it (I’d recommend prefixing any custom tags with something so that they don’t conflict with any plug-in tags that might be introduced):

    Note: this requires WordPress 4.5+ to work because of how get_the_excerpt() is used.

    //Register the placeholder
    EO_Email_Template_Tag_Registry::register( 'alex_event_excerpt', 'alex_event_excerpt_placeholder_callack' );
    
    //Define the callback for this placeholder
    function alex_event_excerpt_placeholder_callack( $tag, $atts, $context ){
        //$tag is 'alex_event_excerpt'
        //$atts is an array of attributes used with the tag
        //$context is an array indexed by 'booking_id', 'event_id', 'occurrence_id' etc. with
        //appropriate values for the context of the e-mail.
    
        $value = get_the_excerpt( $context['event_id'] );
    
        return $value;
    }
    
    Stephen Harris
    #23272

    Super, thank you! Made the changes and it works fine.

    Alex

    Alex Hofstra
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.