Copy booking confirmation email to extra email adress

WordPress Event Management, Calendars & Registration Forums General Question Copy booking confirmation email to extra email adress

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

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #23323

    Hi Stephen,

    In our case a coach is submitting a attendee to a event. The attendee is receiving a confirmation email and
    the admin emailaddres. I recieved a question if it was possible to send a copy of the confirmation
    email to the coach. I browsed the forum and found this topic:
    http://wp-event-organiser.com/forums/topic/remaining-tickets-and-additional-email/

    For my understanding: If a create a extra e-mail field in the booking form like (E-mailaddress coach) the
    code below will send also the confirmation e-mail to “e-mailaddress coach”?
    Or do I have to tell the script that I added a extra e-mailaddress field so it will send also the confirmation e-mail
    to the coach?

    add_filter( ‘eventorganiser_notify_confirmed_booking’, ‘my_notification_handler’, 10, 2 );
    function my_notification_handler( $notify, $booking_id ){
    //Do notification e-mails…
    //Set $notify to false to disable default behaviour
    return $notify;
    }

    This script is placed also in Your Site’s Functionality Plugin?

    Thanks a lot!

    Alex Hofstra
    #23324

    Hi Alex,

    Just to confirm, you want the booking confirmation to go both to the attendee and the coach? The filter you refer to could be used, but this is simply triggered immediately prior to the e-mail being sent and allows you to either abort the e-mail, or do some other action. That could include sending an e-mail to someone else (e.g. the coach).

    There is a better way, however. You can use the e-mail headers CC the coach in. Here I assume that the form field you are using to collect the e-mail has an ID of 123.

    add_filter( 'eventorganiser_booking_confirmed_email_headers', function( $headers, $booking_id ) {
        $coach_email = eo_get_booking_meta( $booking_id, 'meta_123', true );
        $headers[] = "Cc: {$coach_email}";
        return $headers;
    }, 10, 2 );
    
    Stephen Harris
    #23325

    Hi Stephen,

    You assumed right, I want the confirmation in cc to be sent to the coach. Is there a way to tweak the
    id of the field? I have 5 different forms and the field id’s are not the same. In fact id: 9, id: 8, id: 11 and some more.
    Can I list the all in the script? Or repeat the script for all id’s? Is that a way to go?

    Thanks for your quick response earlier, much appreciated 🙂

    Alex

    Alex Hofstra
    #23339

    The best way is to no use the form customiser, but the API where you can specify an ID for the field (and thus have it the same across all forms – it only needs to be unique within the form).

    Here’s a tutorial on how to do that, which incidentally seems to be almost exactly what you’re after: http://wp-event-organiser.com/blog/tutorial/using-form-api-add-additional-fields/

    Stephen Harris
    #23343

    Hi Stephan,

    Got it! That’s the way to go 🙂 just export the form and and create/import new forms with that template and change where needed.

    Thanks!

    Alex Hofstra
Viewing 5 posts - 1 through 5 (of 5 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.