Tribe__Tickets_Plus__Commerce__EDD__Main::send_tickets_email_for_attendees( array $attendees, array $args = array() )
Send RSVPs/tickets email for attendees.
Contents
Parameters
- $attendees
-
(array) (Required) List of attendees.
- $args
-
(array) (Optional) The list of arguments to use for sending ticket emails.
- 'subject'
(string) The email subject. - 'content'
(string) The email content. - 'from_name'
(string) The name to send tickets from. - 'from_email'
(string) The email to send tickets from. - 'headers'
(array|string) The list of headers to send. - 'attachments'
(array) The list of attachments to send. - 'provider'
(string) The provider slug (rsvp, tpp, woo, edd). - 'post_id'
(int) The post/event ID to send the emails for. - 'order_id'
(string|int) The order ID to send the emails for.
Default value: array()
- 'subject'
Return
(int) The number of emails sent successfully.
Source
File: src/Tribe/Commerce/EDD/Main.php
public function send_tickets_email_for_attendees( $attendees, $args = [] ) {
global $edd_options;
$payment_id = $args['order_id'];
$payment_data = edd_get_payment_meta( $payment_id );
$user_id = edd_get_payment_user_id( $payment_id );
$user_info = maybe_unserialize( $payment_data['user_info'] );
$email = edd_get_payment_user_email( $payment_id );
$subject = wp_strip_all_tags( Tribe__Utils__Array::get( 'ticket_subject', $edd_options, '' ), true );
/**
* Allow filtering the Easy Digital Downloads ticket email subject.
*
* @param string $subject The email subject.
* @param int $payment_id The payment ID.
*/
$subject = apply_filters( 'edd_ticket_receipt_subject', $subject, $payment_id );
$subject = edd_email_template_tags( $subject, $payment_data, $payment_id );
$from_name = Tribe__Utils__Array::get( 'from_name', $edd_options, get_bloginfo( 'name' ) );
$from_email = Tribe__Utils__Array::get( 'from_email', $edd_options, get_option( 'admin_email' ) );
if ( isset( $user_id ) && 0 < $user_id ) {
$user_data = get_userdata( $user_id );
$name = $user_data->display_name;
} elseif ( isset( $user_info['first_name'], $user_info['last_name'] ) ) {
$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
} else {
$name = $email;
}
/**
* Allow filtering the Easy Digital Downloads ticket email headers.
*
* @param string $headers The email headers to use.
* @param int $payment_id The payment ID.
* @param array $payment_data The payment data.
*/
$headers = apply_filters( 'edd_ticket_receipt_headers', '', $payment_id, $payment_data );
/**
* Allow filtering the Easy Digital Downloads ticket email attachments.
*
* @param array $attachments The email attachments to use.
* @param int $payment_id The payment ID.
* @param array $payment_data The payment data.
*/
$attachments = apply_filters( 'edd_ticket_receipt_attachments', [], $payment_id, $payment_data );
$args = array_merge(
[
'subject' => $subject,
'from_name' => $from_name,
'from_email' => $from_email,
'headers' => $headers,
'attachments' => $attachments,
'provider' => 'edd',
],
$args
);
return parent::send_tickets_email_for_attendees( $attendees, $args );
}
Changelog
| Version | Description |
|---|---|
| 5.1.0 | Introduced. |