Created
May 28, 2021 15:45
-
-
Save skyshab/95af3c493546ca3373bbfde1f58b34db to your computer and use it in GitHub Desktop.
default rsvp attendees to be opted in to being displayed in attendees list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Block: RSVP | |
* Actions - Success - Toggle | |
* | |
* Override this template in your own theme by creating a file at: | |
* [your-theme]/tribe/tickets/v2/rsvp/actions/success/toggle.php | |
* | |
* See more documentation about our Blocks Editor templating system. | |
* | |
* @link https://evnt.is/1amp Help article for RSVP & Ticket template files. | |
* | |
* @var Tribe__Tickets__Ticket_Object $rsvp The rsvp ticket object. | |
* @var boolean $opt_in_toggle_hidden The order status of the RSVP that was made. | |
* @var string $opt_in_attendee_ids The list of attendee IDs to send. | |
* @var string $opt_in_nonce The nonce for opt-in AJAX requests. | |
* @var boolean $opt_in_checked Whether the opt-in field should be checked. | |
* | |
* @since 5.0.0 | |
* @version 5.0.0 | |
*/ | |
if ( $opt_in_toggle_hidden ) { | |
return; | |
} | |
$toggle_id = 'toggle-rsvp-' . $rsvp->ID; | |
?> | |
<div class="tribe-tickets__rsvp-actions-success-going-toggle tribe-common-form-control-toggle"> | |
<input | |
class="tribe-common-form-control-toggle__input tribe-tickets__rsvp-actions-success-going-toggle-input" | |
id="<?php echo esc_attr( $toggle_id ); ?>" | |
name="toggleGroup" | |
type="checkbox" | |
value="toggleOne" | |
checked="checked" | |
style="display: none;" | |
data-rsvp-id="<?php echo esc_attr( $rsvp->ID ); ?>" | |
data-attendee-ids="<?php echo esc_attr( $opt_in_attendee_ids ); ?>" | |
data-opt-in-nonce="<?php echo esc_attr( $opt_in_nonce ); ?>" | |
/> | |
<?php $this->template( 'v2/rsvp/actions/success/tooltip', [ 'rsvp' => $rsvp ] ); ?> | |
</div> | |
<script type="text/javascript"> | |
if ( typeof $input === 'undefined' ) { | |
const $input = jQuery( '.tribe-tickets__rsvp-actions-success-going-toggle-input' ); | |
const $container = jQuery('.tribe-tickets__rsvp-wrapper'); | |
const data = { | |
action: 'tribe_tickets_rsvp_handle', | |
ticket_id: $input.data( 'rsvp-id' ), | |
step: 'opt-in', | |
opt_in: true, | |
opt_in_nonce: $input.data( 'opt-in-nonce' ), | |
attendee_ids: $input.data( 'attendee-ids' ), | |
}; | |
tribe.tickets.rsvp.manager.request( data, $container ); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment