From a9519f05af960610e45a2ded8d72232b3e6b60a6 Mon Sep 17 00:00:00 2001 From: Steven Dufresne Date: Wed, 23 Oct 2024 13:39:50 +0900 Subject: [PATCH] Change ticket messaging when camp is closed. (#1404) --- .../wp-content/plugins/camptix/camptix.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/public_html/wp-content/plugins/camptix/camptix.php b/public_html/wp-content/plugins/camptix/camptix.php index b47780887..f40992a29 100644 --- a/public_html/wp-content/plugins/camptix/camptix.php +++ b/public_html/wp-content/plugins/camptix/camptix.php @@ -5485,10 +5485,14 @@ function form_start() { $this->error( __( "It doesn't look like your form submitted any attendee information. Please try again.", 'wordcamporg' ) ); } - if ( ! $available_tickets ) { + if ( ! $available_tickets && ! $this->is_wordcamp_closed() ) { $this->notice( __( 'Sorry, but there are currently no tickets for sale. Please try again later.', 'wordcamporg' ) ); } + if ( $this->is_wordcamp_closed() ) { + $this->notice( __( 'This event has completed.', 'wordcamporg' ) ); + } + if ( $available_tickets && isset( $this->reservation ) && $this->reservation ) { $this->info( __( 'You are using a reservation, cool!', 'wordcamporg' ) ); } @@ -6871,7 +6875,7 @@ function is_ticket_valid_for_purchase( $post ) { $end_date = absint( $wordcamp->meta['End Date (YYYY-mm-dd)'][0] ?? 0 ); // Event is finalised. - if ( $wordcamp && 'wcpt-closed' === $wordcamp->post_status ) { + if ( $this->is_wordcamp_closed() ) { return false; } @@ -8572,6 +8576,16 @@ public function tmp( $key, $value = null ) { return $value; } + + /** + * Return whether the wordcamp is closed. + * + * @return bool + */ + public function is_wordcamp_closed() { + $wordcamp = get_wordcamp_post(); + return 'wcpt-closed' === $wordcamp->post_status; + } } // Initialize the $camptix global.