-
-
Save vicskf/c807167bd0a89a13af7f9ad8d351d184 to your computer and use it in GitHub Desktop.
<?php | |
/** | |
* BCC event organizers email on all Event Tickets' RSVP and commerce ticket emails so they get a copy of it too | |
*/ | |
function bcc_all_event_organizers( $headers, $event_id, $order_id ) { | |
//check if has organizer | |
if ( !tribe_has_organizer( $event_id ) ) { | |
return $headers; | |
} | |
//get all organizers asociated to the event | |
$event_organizers_ids = tribe_get_organizer_ids( $event_id ); | |
//get all the event organizers emails for the event | |
$event_organizers_emails = array(); | |
foreach ($event_organizers_ids as $organizer_id ) { | |
$organizer_email = tribe_get_organizer_email( $organizer_id, false ); | |
//make sure it's a valid email | |
if ( is_email( $organizer_email ) ) { | |
$event_organizers_emails[] = $organizer_email; | |
} | |
} | |
if ( empty( $event_organizers_emails ) ) { | |
return $headers; | |
} | |
$to = implode( ", ", $event_organizers_emails ); | |
$headers[] = sprintf( 'Bcc: %s', $to ); | |
return $headers; | |
} | |
add_filter( 'tribe_rsvp_email_headers', 'bcc_all_event_organizers', 20, 3 ); |
Hi @mputman007 where in the code snippet should this new declaration sit?
Hi @mputman007 where in the code snippet should this new declaration sit?
I put it at Line 29.
Thank you for this awesome knowledge, I don't get it why the plugin makers wouldn't put such a basic functionality in their application.
hi can someone explain how this works. Thanks
Read the top line of the post and the commented lines of the code. It's all there.
i just need single email for the admin confirmation or to let the admin know that somebody buy a ticket.
You could probably just use this extension: https://theeventscalendar.com/extensions/organizer-notification-email/
thank you, i have 1 last question can i edit message content for this extension?
Contact the contributors that created the plugin. They should be able to tell you. I don't use it.
i just need to put information of the client who buy ticket
Thank you, this is working pretty well for me. However the only issue is that it's only working for RSVPs. When I purchase a ticket, the organizer doesn't receive a notification email. I'm using Event Tickets Plus with Tickets Commerce and Stripe as the payment gateway. Thought?
@limaj123 Do you mean https://theeventscalendar.com/extensions/organizer-notification-email/
If so, that plugin only sends a link to view the attendees on in the WP Admin. This is undesirable because we don't want every organizer poking around in our website admin. Instead we'd like to send the attendee information to the organizer in an email. Using the snippet above, this is working exactly as planned but only for RSVP. Hoping someone has thoughts on why it's not working for Tickets Commerce.
I try to put this snippet in bp-customp.php, i want to send the notification to one organizer with multiple emails adresses.
In the email organizer field, i have two emails separated by a comma, but the notification is not send :(
It's work only when there is a single email in the field.. Any idea to solve my issue ? Thanks for help
Due to the display of the organizer and their email address in the information block of the event, only one email address per organizer is recommended. You may try adding a second organizer with the same name and the second email address to get the notifications going both places. This will mean, however, that your organizer will display on the event twice, one with each email address.
Thanks for your quick reply. Unfortunately this is not very practical, I will ask the plugin developer if he can do something for this
Good luck. They have been less than helpful over the years.
The latest update of Event Tickets and Event Tickets Plus to 4.12.1 breaks this code because of deprecation of string support. Adding a declaration of $headers = array( 'Content-type: text/html' ); will fix it.