Created
July 6, 2022 15:08
-
-
Save rafsuntaskin/7365e6790d2654678975e654508d3019 to your computer and use it in GitHub Desktop.
Attendee Fatal error data recovery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* In some cases where the user input for purchaser name is corrputed we need to | |
* replace the purhcaser name with purchaser email. | |
*/ | |
add_filter( 'tribe_tickets_attendee_data', 'rt_et_filter_corrupted_attendee', 10, 4 ); | |
function rt_et_filter_corrupted_attendee( $attendee_data, $provider, $attendee, $post_id ) { | |
if ( ! is_array( $attendee_data ) ) { | |
return $attendee_data; | |
} | |
if ( ! is_string( $attendee_data['purchaser_name'] ) ) { | |
$attendee_data['purchaser_name'] = $attendee_data['purchaser_email']; | |
} | |
if ( ! is_string( $attendee_data['holder_name'] ) ) { | |
$attendee_data['holder_name'] = $attendee_data['holder_email']; | |
} | |
return $attendee_data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment