RSVP entries not recorded
-
Users are getting the confirmation on page but no mail is sent to them nor record created, number of available tickets too is unchanged
A small clarification-
Following a previous topic I did try some code in function.php aiming at limiting to one the number of rsvp
//Disable number counter for rsvp add_action( 'wp_footer', 'tribe_limit_rsvps_to_one' ); function tribe_limit_rsvps_to_one() { wp_enqueue_script( 'jquery' ); ?> <script> jQuery(document).ready(function($){ if ( $('.tribe-events-tickets' ).length ) { var $input = $('.tribe-events-tickets' ).find( 'input.tribe-ticket-quantity' ); $input.attr( 'type', 'text' ); //$input.attr( 'disabled', 'disabled' ); $input.attr( 'max', '1' ); $input.val( '1' ); } }); </script> <?php }
it worked but prevented the auto fill of user’s data, stopping the whole process.
Another topic suggested a fix with a override on the file rsvp.php, following is the code for that page:<?php /** * This template renders the RSVP ticket form * * @version 4.2.7 * * @var bool $must_login */ $is_there_any_product = false; $is_there_any_product_to_sell = false; ob_start(); $messages = Tribe__Tickets__RSVP::get_instance()->get_messages(); $messages_class = $messages ? 'tribe-rsvp-message-display' : ''; $now = current_time( 'timestamp' ); ?> <form action="" class="cart <?php echo esc_attr( $messages_class ); ?>" method="post" enctype='multipart/form-data'> <h2 class="tribe-events-tickets-title"><?php esc_html_e( 'RSVP', 'event-tickets' ) ?></h2> <div class="tribe-rsvp-messages"> <?php if ( $messages ) { foreach ( $messages as $message ) { ?> <div class="tribe-rsvp-message tribe-rsvp-message-<?php echo esc_attr( $message->type ); ?>"> <?php echo esc_html( $message->message ); ?> </div> <?php }//end foreach }//end if ?> <div class="tribe-rsvp-message tribe-rsvp-message-error tribe-rsvp-message-confirmation-error" style="display:none;"> <?php esc_html_e( 'Please fill in the RSVP confirmation name and email fields.', 'event-tickets' ); ?> </div> </div> <table width="100%" class="tribe-events-tickets tribe-events-tickets-rsvp"> <?php foreach ( $tickets as $ticket ) { // if the ticket isn't an RSVP ticket, then let's skip it if ( 'Tribe__Tickets__RSVP' !== $ticket->provider_class ) { continue; } if ( $ticket->date_in_range( $now ) ) { $is_there_any_product = true; ?> <tr> <td class="tribe-ticket quantity" data-product-id="<?php echo esc_attr( $ticket->ID ); ?>"> <input type="hidden" name="product_id[]" value="<?php echo absint( $ticket->ID ); ?>"> <?php if ( $ticket->is_in_stock() ) { $is_there_any_product_to_sell = true; ?> <input type="number" class="tribe-ticket-quantity" min="0" max="<?php echo esc_attr( $ticket->remaining() ); ?>" name="quantity_<?php echo absint( $ticket->ID ); ?>" value="0" <?php disabled( $must_login ); ?> > <?php if ( $ticket->managing_stock() ) { ?> <span class="tribe-tickets-remaining"> <?php echo sprintf( esc_html__( '%1$s out of %2$s available', 'event-tickets' ), $ticket->remaining(), $ticket->original_stock() ); ?> </span> <?php } }//end if else { ?> <span class="tickets_nostock"><?php esc_html_e( 'Out of stock!', 'event-tickets' ); ?></span> <?php } ?> </td> <td class="tickets_name"> <?php echo esc_html( $ticket->name ); ?> </td> <td class="tickets_description" colspan="2"> <?php echo esc_html( $ticket->description ); ?> </td> </tr> <?php /** * Allows injection of HTML after an RSVP ticket table row * * @var Event ID * @var Tribe__Tickets__Ticket_Object */ do_action( 'event_tickets_rsvp_after_ticket_row', tribe_events_get_ticket_event( $ticket->id ), $ticket ); } }//end foreach if ( $is_there_any_product_to_sell ) { ?> <tr class="tribe-tickets-meta-row"> <td colspan="4" class="tribe-tickets-attendees"> <header><?php esc_html_e( 'Send RSVP confirmation to:', 'event-tickets' ); ?></header> <?php /** * Allows injection of HTML before RSVP ticket confirmation fields * * @var array of Tribe__Tickets__Ticket_Object */ do_action( 'event_tickets_rsvp_before_confirmation_fields', $tickets ); $name = ''; $email = ''; $current_user = wp_get_current_user(); if ( $current_user->ID ) { $name = $current_user->user_firstname . ' ' . $current_user->user_lastname; $email = $current_user->user_email; } ?> <table class="tribe-tickets-table"> <tr class="tribe-tickets-full-name-row"> <td> <label for="tribe-tickets-full-name"><?php esc_html_e( 'Full Name', 'event-tickets' ); ?>:</label> </td> <td colspan="3"> <input type="text" name="attendee[full_name]" id="tribe-tickets-full-name" value="<?php echo $name; ?>"> </td> </tr> <tr class="tribe-tickets-email-row"> <td> <label for="tribe-tickets-email"><?php esc_html_e( 'Email', 'event-tickets' ); ?>:</label> </td> <td colspan="3"> <input type="email" name="attendee[email]" id="tribe-tickets-email" value="<?php echo $email; ?>"> </td> </tr> <tr class="tribe-tickets-order_status-row"> <td> <label for="tribe-tickets-order_status"><?php esc_html_e( 'RSVP', 'event-tickets' ); ?>:</label> </td> <td colspan="3"> <?php Tribe__Tickets__Tickets_View::instance()->render_rsvp_selector( 'attendee[order_status]', '' ); ?> </td> </tr> <?php if ( class_exists( 'Tribe__Tickets_Plus__Attendees_List' ) && ! Tribe__Tickets_Plus__Attendees_List::is_hidden_on( get_the_ID() ) ) : ?> <tr class="tribe-tickets-attendees-list-optout"> <td colspan="4"> <input type="checkbox" name="attendee[optout]" id="tribe-tickets-attendees-list-optout"> <label for="tribe-tickets-attendees-list-optout"><?php esc_html_e( 'Don\'t list me on the public attendee list', 'event-tickets' ); ?></label> </td> </tr> <?php endif; ?> </table> </td> </tr> <tr> <td colspan="4" class="add-to-cart"> <?php if ( $must_login ): ?> <?php $login_url = Tribe__Tickets__Tickets::get_login_url() ?> <a href="<?php echo $login_url; ?>"><?php esc_html_e( 'Login to RSVP', 'event-tickets' );?></a> <?php else: ?> <button type="submit" name="tickets_process" value="1" class="button alt"><?php esc_html_e( 'Confirm RSVP', 'event-tickets' );?></button> <?php endif; ?> </td> </tr> <?php } ?> </table> </form> <?php $content = ob_get_clean(); if ( $is_there_any_product ) { echo $content; // If we have rendered tickets there is generally no need to display a 'tickets unavailable' message // for this post $this->do_not_show_tickets_unavailable_message(); } else { // Indicate that we did not render any tickets, so a 'tickets unavailable' message may be // appropriate (depending on whether other ticket providers are active and have a similar // result) $this->maybe_show_tickets_unavailable_message( $tickets ); }
It turns out that the above code is fixing the auto fill problem (the error was: Please fill in the RSVP confirmation name and email fields) but creates some new issue preventing the RSVP entry from working correctly
I do not have a live example Url of the issue because I have removed both the code from function.php and the override to rsvp.php.
Thank you
Andrea
- The topic ‘RSVP entries not recorded’ is closed to new replies.