Making WordPress.org


Ignore:
Timestamp:
07/17/2024 11:19:52 AM (2 years ago)
Author:
psrpinto
Message:

Translate: Sync "Translation Events" from GitHub

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/routes/user/attend-event.php

    r13753 r13906  
    3232
    3333    public function handle( int $event_id ): void {
     34        $nonce_name = '_attendee_nonce';
     35        if ( isset( $_POST['_attendee_nonce'] ) ) {
     36            $nonce_value = sanitize_text_field( wp_unslash( $_POST['_attendee_nonce'] ) );
     37            if ( ! wp_verify_nonce( $nonce_value, $nonce_name ) ) {
     38                $this->die_with_error( esc_html__( 'You are not authorized to change the attendance mode of this attendee', 'gp-translation-events' ), 403 );
     39            }
     40        }
    3441        $user = wp_get_current_user();
    3542        if ( ! $user ) {
     
    4754        }
    4855
    49         $attendee = $this->attendee_repository->get_attendee_for_event_for_user( $event->id(), $user_id );
     56        $attendee           = $this->attendee_repository->get_attendee_for_event_for_user( $event->id(), $user_id );
     57        $is_remote_attendee = isset( $_POST['attend_remotely'] );
     58
    5059        if ( $attendee instanceof Attendee ) {
    5160            if ( $attendee->is_contributor() ) {
     
    5463            $this->attendee_repository->remove_attendee( $event->id(), $user_id );
    5564        } else {
    56             $attendee = new Attendee( $event->id(), $user_id );
     65            $attendee = new Attendee( $event->id(), $user_id, false, false, array(), $is_remote_attendee );
    5766            $this->attendee_adder->add_to_event( $event, $attendee );
    5867        }
Note: See TracChangeset for help on using the changeset viewer.