From 8b1501cac868e970ae60405ed818963a7ca206fd Mon Sep 17 00:00:00 2001 From: Steven Dufresne Date: Wed, 23 Oct 2024 12:33:11 +0900 Subject: [PATCH] Don't show if we have a tix_action set. (#1414) --- .../plugins/camptix/addons/require-login.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 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 981005b46..67111d711 100644 --- a/public_html/wp-content/plugins/camptix/addons/require-login.php +++ b/public_html/wp-content/plugins/camptix/addons/require-login.php @@ -73,9 +73,7 @@ public function block_unauthenticated_actions() { // Temporary: We don't want to block users from editing tickets. // See: https://github.com/WordPress/wordcamp.org/issues/1393. - $user_is_editing_ticket = in_array( $_REQUEST['tix_action'], array( 'access_tickets', 'edit_attendee' ) ); - - if ( ! is_user_logged_in() && ! $user_is_editing_ticket ) { + if ( ! is_user_logged_in() && ! $this->user_is_editing_ticket() ) { $args = array(); // If this was a registration, pass through the selected tickets and coupon. if ( 'attendee_info' === $_REQUEST['tix_action'] && isset( $_REQUEST['tix_tickets_selected'] ) ) { @@ -125,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() ) { + if ( ! is_user_logged_in() && ! $this->user_is_editing_ticket() ) { $camptix->notice( apply_filters( 'camptix_require_login_please_login_message', sprintf( @@ -834,6 +832,15 @@ public function prevent_unknown_attendees_viewing_private_content( $parameters ) return $parameters; } + + /** + * Checks if the user is performing actions that require ticket access. + * + * @return bool True if the user is editing or accessing a ticket, false otherwise. + */ + protected function user_is_editing_ticket() { + return isset( $_REQUEST['tix_action'] ) && in_array( $_REQUEST['tix_action'], array( 'access_tickets', 'edit_attendee' ) ); + } } // CampTix_Require_Login camptix_register_addon( 'CampTix_Require_Login' );