From bb642686f8edf0584a3ce5697388249585ddb6a1 Mon Sep 17 00:00:00 2001 From: StevenDufresne Date: Mon, 21 Oct 2024 10:21:11 +0900 Subject: [PATCH 1/5] Don\'t show login banner if no tickets exist. --- .../wp-content/plugins/camptix/addons/require-login.php | 1 + public_html/wp-content/plugins/camptix/camptix.php | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/public_html/wp-content/plugins/camptix/addons/require-login.php b/public_html/wp-content/plugins/camptix/addons/require-login.php index 67111d711..39a4c95a3 100644 --- a/public_html/wp-content/plugins/camptix/addons/require-login.php +++ b/public_html/wp-content/plugins/camptix/addons/require-login.php @@ -122,6 +122,7 @@ public function ticket_form_message() { return; } + // Warn users that they will need to login to purchase a ticket if ( ! is_user_logged_in() && ! $this->user_is_editing_ticket() ) { $camptix->notice( apply_filters( diff --git a/public_html/wp-content/plugins/camptix/camptix.php b/public_html/wp-content/plugins/camptix/camptix.php index f40992a29..669dc7280 100644 --- a/public_html/wp-content/plugins/camptix/camptix.php +++ b/public_html/wp-content/plugins/camptix/camptix.php @@ -8586,6 +8586,15 @@ public function is_wordcamp_closed() { $wordcamp = get_wordcamp_post(); return 'wcpt-closed' === $wordcamp->post_status; } + + /** + * Return whether there are available tickets. + * + * @return bool + */ + public function has_tickets_available() { + return $this->number_available_tickets() > 0; + } } // Initialize the $camptix global. From 6140ad2dd8ef89e148734979f85d62712ed119ab Mon Sep 17 00:00:00 2001 From: StevenDufresne Date: Mon, 21 Oct 2024 10:49:44 +0900 Subject: [PATCH 2/5] Remove empty line. --- public_html/wp-content/plugins/camptix/addons/require-login.php | 1 - 1 file changed, 1 deletion(-) diff --git a/public_html/wp-content/plugins/camptix/addons/require-login.php b/public_html/wp-content/plugins/camptix/addons/require-login.php index 39a4c95a3..67111d711 100644 --- a/public_html/wp-content/plugins/camptix/addons/require-login.php +++ b/public_html/wp-content/plugins/camptix/addons/require-login.php @@ -122,7 +122,6 @@ public function ticket_form_message() { return; } - // Warn users that they will need to login to purchase a ticket if ( ! is_user_logged_in() && ! $this->user_is_editing_ticket() ) { $camptix->notice( apply_filters( From 3fce2e555d1154a79a42d53e598a190c9adb9db4 Mon Sep 17 00:00:00 2001 From: StevenDufresne Date: Wed, 23 Oct 2024 14:21:56 +0900 Subject: [PATCH 3/5] Make sure we only show notice when tickets are available. --- public_html/wp-content/plugins/camptix/addons/require-login.php | 2 +- public_html/wp-content/plugins/camptix/camptix.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public_html/wp-content/plugins/camptix/addons/require-login.php b/public_html/wp-content/plugins/camptix/addons/require-login.php index 67111d711..76a77b7a5 100644 --- a/public_html/wp-content/plugins/camptix/addons/require-login.php +++ b/public_html/wp-content/plugins/camptix/addons/require-login.php @@ -123,7 +123,7 @@ public function ticket_form_message() { } // Warn users that they will need to login to purchase a ticket - if ( ! is_user_logged_in() && ! $this->user_is_editing_ticket() ) { + if ( ! is_user_logged_in() && $camptix->has_tickets_available() && ! $this->user_is_editing_ticket() ) { $camptix->notice( apply_filters( 'camptix_require_login_please_login_message', sprintf( diff --git a/public_html/wp-content/plugins/camptix/camptix.php b/public_html/wp-content/plugins/camptix/camptix.php index 669dc7280..744a66d2c 100644 --- a/public_html/wp-content/plugins/camptix/camptix.php +++ b/public_html/wp-content/plugins/camptix/camptix.php @@ -8594,7 +8594,7 @@ public function is_wordcamp_closed() { */ public function has_tickets_available() { return $this->number_available_tickets() > 0; - } + } } // Initialize the $camptix global. From d25c90d07b4000f24f4b596f348fc6a4daaecbd9 Mon Sep 17 00:00:00 2001 From: StevenDufresne Date: Wed, 23 Oct 2024 14:23:51 +0900 Subject: [PATCH 4/5] Remove empty space. --- public_html/wp-content/plugins/camptix/addons/require-login.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public_html/wp-content/plugins/camptix/addons/require-login.php b/public_html/wp-content/plugins/camptix/addons/require-login.php index 76a77b7a5..53f4141cb 100644 --- a/public_html/wp-content/plugins/camptix/addons/require-login.php +++ b/public_html/wp-content/plugins/camptix/addons/require-login.php @@ -123,7 +123,7 @@ public function ticket_form_message() { } // Warn users that they will need to login to purchase a ticket - if ( ! is_user_logged_in() && $camptix->has_tickets_available() && ! $this->user_is_editing_ticket() ) { + if ( ! is_user_logged_in() && $camptix->has_tickets_available() && ! $this->user_is_editing_ticket() ) { $camptix->notice( apply_filters( 'camptix_require_login_please_login_message', sprintf( From 39db4f0bb6827afe68c46189204b65579a47e151 Mon Sep 17 00:00:00 2001 From: StevenDufresne Date: Wed, 23 Oct 2024 14:24:16 +0900 Subject: [PATCH 5/5] Fix formatter. --- public_html/wp-content/plugins/camptix/camptix.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public_html/wp-content/plugins/camptix/camptix.php b/public_html/wp-content/plugins/camptix/camptix.php index 744a66d2c..f28a1164f 100644 --- a/public_html/wp-content/plugins/camptix/camptix.php +++ b/public_html/wp-content/plugins/camptix/camptix.php @@ -8593,8 +8593,8 @@ public function is_wordcamp_closed() { * @return bool */ public function has_tickets_available() { - return $this->number_available_tickets() > 0; - } + return $this->number_available_tickets() > 0; + } } // Initialize the $camptix global.