custom field in confirmation email

This topic contains 1 reply, has 2 voices, and was last updated by  Stephen Harris 8 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #22575

    Hallo Stephen

    I created a custom field in the form and now I want to show the value out of this custom field as Tag %—-% in the confirmation email . How can I do this? Thanks for your help.

    Regards.
    Stefan

    Stefan Rendl
    #22576

    Hi Stefan, you can register a custom tag for this:

    EO_Email_Template_Tag_Registry::register( 'mycustomtag', 'mycustomtag_callack' );
    function mycustomtag_callack( $tag, $atts, $context ){
        //$tag is 'mytag'
        //$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.
    
        $custom_field_id = $atts['id']; //or you can hard-code this
        $value = eo_get_booking_meta( $context['booking_id'], 'meta_'.$custom_field_id, true );
    
        return $value;
    }
    

    Usage example:

    %mycustomtag id=123%
    

    (replace 123 with the ID of the field). – or you can hard-code the ID and not specify it as an attribute.

    • This reply was modified 8 years, 10 months ago by  Stephen Harris. Reason: Fix variable name error
    Stephen Harris
Viewing 2 posts - 1 through 2 (of 2 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.