Confirmation emails

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

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

    Hi Stephen,

    A couple of questions please:-

    1. Plugin confirmation emails are being sent from the WordPress Administration Email Address. How may I change this to a different email address?
    2. I’d like to attach a PDF to confirmed bookings. How would I do that please?

    Thanks
    David

    Squirrelhouse
    #37702

    Hi David,

    Details on how to change the sender of the confirmation emails can be found here: http://docs.wp-event-organiser.com/bookings/notification-emails/

    In particular, the following code would allow you to change the email that confirmation emails are sent from, and which email is notified of a new/confirmed bookings:

    function my_event_admin_email( $email ){
          //Change $email;
          return $email;        
    }
    add_filter( 'eventorganiser_admin_email', 'my_event_admin_email' );
    

    As for attaching PDFs there is no feature provided for this, however, I have open sourced this plug-in which generates and attaches PDF tickets which you could re-purpose: https://bitbucket.org/stephenharris/event-organiser-pdf-tickets/src/master/

    It comes with the health warning that this is code that hasn’t been looked at it or used in years. The recent commits were only to remove some comment-ed out code.

    However, if you don’t want to generate PDFs on the fly and instead just attach a static PDF, it’s much simpler and you won’t need to the above extension.

     add_filter('eventorganiser_booking_confirmed_email_attachments', function($attachments, $booking_id ) {
         $attachments[] = WP_CONTENT_DIR . '/path/to/file.pdf';
         return $attachments;
     }, 10, 2);
    
    Stephen Harris
    #37705

    Hi Stephen, Many thanks for these. For the PDF, it is a static PDF so something based on your code should work well. It is a different PDF depending on the Event Category slug so would this look to be about right within the filter :-

    if ($event-category == 'efaw') {$attachments[] = WP_CONTENT_DIR . '/path/to/EFAW.pdf';
    } elseif ($event-category == 'faw') {$attachments[] = WP_CONTENT_DIR . '/path/to/FAW.pdf';
    } elseif ($event-category == 'fawr') {$attachments[] = WP_CONTENT_DIR . '/path/to/FAWR.pdf';
    } else { }
    return $attachments;

    • This reply was modified 4 years ago by  Squirrelhouse.
    • This reply was modified 4 years ago by  Squirrelhouse.
    Squirrelhouse
    #37710

    Sorry about the abortive attempts above to provide the code but I can confirm it works fine 🙂
    Many thanks
    David

    Squirrelhouse
    #38497

    There were further issues which Stephen helped me with and so for completeness the code should now be:-

    add_filter('eventorganiser_booking_confirmed_email_attachments', function($attachments, $booking_id ) {
    $event_id = eo_get_booking_meta( $booking_id, 'event_id' );
    if (has_term('efaw', 'event-category', $event_id )) {
        $attachments[] = WP_CONTENT_DIR . '/path/to/EFAW.pdf';
    } else if (has_term('faw', 'event-category', $event_id )) {
        $attachments[] = WP_CONTENT_DIR . '/path/to/FAW.pdf';
    } else if (has_term('fawr', 'event-category', $event_id )) {
        $attachments[] = WP_CONTENT_DIR . '/path/to/FAWR.pdf';
    }
    return $attachments; }, 10, 2);
    
    Squirrelhouse
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.