Skip to content

Commit

Permalink
Don't show if we have a tix_action set. (#1414)
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenDufresne authored Oct 23, 2024
1 parent 6a94ae2 commit 8b1501c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions public_html/wp-content/plugins/camptix/addons/require-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ) ) {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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' );

0 comments on commit 8b1501c

Please sign in to comment.