Hi Stephen,
A couple of questions please:-
- Plugin confirmation emails are being sent from the WordPress Administration Email Address. How may I change this to a different email address?
- I’d like to attach a PDF to confirmed bookings. How would I do that please?
Thanks
David
Squirrelhouse
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
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, 8 months ago by Squirrelhouse.
-
This reply was modified 4 years, 8 months ago by Squirrelhouse.
Squirrelhouse
Sorry about the abortive attempts above to provide the code but I can confirm it works fine 🙂
Many thanks
David
Squirrelhouse
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