Tribe__Tickets__RSVP::send_non_attendance_confirmation( int $order_id, int $event_id )
Dispatches a confirmation email that acknowledges the user has RSVP’d in cases where they have indicated that they will *not* be attending.
Contents
Parameters
- $order_id
-
(int) (Required) The order ID.
- $event_id
-
(int) (Required) The event ID.
Return
(bool) Whether the email was sent or not.
Source
File: src/Tribe/RSVP.php
public function send_non_attendance_confirmation( $order_id, $event_id ) {
$attendees = $this->get_attendees_by_order_id( $order_id );
if ( empty( $attendees ) ) {
return;
}
// For now all ticket holders in an order share the same email
$to = $attendees['0']['holder_email'];
if ( ! is_email( $to ) ) {
return;
}
/**
* Filters the non attending RSVP tickets email headers
*
* @since 4.5.2 added new parameters $event_id and $order_id
* @since 4.5.5 changed filter name to be unique to non attendance emails
*
* @param array email headers
* @param int $event_id
* @param int $order_id
*/
$headers = apply_filters( 'tribe_rsvp_non_attendance_email_headers', array( 'Content-type: text/html' ), $event_id, $order_id );
/**
* Filters the non attending RSVP tickets email attachments
*
* @since 4.5.2 added new parameters $event_id and $order_id
* @since 4.5.5 changed filter name to be unique to non attendance emails
*
* @param array attachments
* @param int $event_id
* @param int $order_id
*/
$attachments = apply_filters( 'tribe_rsvp_non_attendance_email_attachments', array(), $event_id, $order_id );
/**
* Filters the non attending RSVP tickets email recepient
*
* @since 4.5.2 added new parameters $event_id and $order_id
* @since 4.5.5 changed filter name to be unique to non attendance emails
*
* @param string $to
* @param int $event_id
* @param int $order_id
*/
$to = apply_filters( 'tribe_rsvp_non_attendance_email_recipient', $to, $event_id, $order_id );
/**
* Filters the non attending RSVP tickets email subject
*
* @since 4.5.2 added new parameters $event_id and $order_id
* @since 4.5.5 changed filter name to be unique to non attendance emails
*
* @param string
* @param int $event_id
* @param int $order_id
*/
$subject = apply_filters( 'tribe_rsvp_non_attendance_email_subject',
sprintf( __( 'You confirmed you will not be attending %s', 'event-tickets' ), get_the_title( $event_id ) ),
$event_id,
$order_id
);
$template_data = array( 'event_id' => $event_id, 'order_id' => $order_id, 'attendees' => $attendees );
/**
* Filters the non attending RSVP tickets email content
*
* @since 4.5.2 added new parameters $event_id and $order_id
* @since 4.5.5 changed filter name to be unique to non attendance emails
*
* @param string email content
* @param int $event_id
* @param int $order_id
*/
$content = apply_filters( 'tribe_rsvp_non_attendance_email_content',
tribe_tickets_get_template_part( 'tickets/email-non-attendance', null, $template_data, false ),
$event_id,
$order_id
);
wp_mail( $to, $subject, $content, $headers, $attachments );
}
Changelog
| Version | Description |
|---|---|
| 5.6.0 | Revert to use the code from before Tickets Emails. |
| 5.5.10 | Introduced. |