From c2d85835e72c7c3c6a9fe389a3946cd31c2f49ff Mon Sep 17 00:00:00 2001 From: Paul Kevan <2290623+pkevan@users.noreply.github.com> Date: Tue, 5 Nov 2024 05:36:37 +0000 Subject: [PATCH] Add check to is_wordcamp_closed (#1419) When a `get_wordcamp_post()` cannot find a post, it return false, which then breaks the check against `post_status` - this stops that happening, and should also allow testing of tickets (when there is no post on central.wordcamp.org). --- public_html/wp-content/plugins/camptix/camptix.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public_html/wp-content/plugins/camptix/camptix.php b/public_html/wp-content/plugins/camptix/camptix.php index f81696d27..67c50920b 100644 --- a/public_html/wp-content/plugins/camptix/camptix.php +++ b/public_html/wp-content/plugins/camptix/camptix.php @@ -8601,6 +8601,10 @@ public function tmp( $key, $value = null ) { */ public function is_wordcamp_closed() { $wordcamp = get_wordcamp_post(); + // get_wordcamp_post() returns false if no post exists, so avoid breaking by returning here since it is not explicitly closed. + if ( false === $wordcamp ) { + return false; + } return 'wcpt-closed' === $wordcamp->post_status; }