Skip to content

Commit

Permalink
Change ticket messaging when camp is closed. (#1404)
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenDufresne authored Oct 23, 2024
1 parent 8b1501c commit a9519f0
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions public_html/wp-content/plugins/camptix/camptix.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) );
}
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit a9519f0

Please sign in to comment.