Last active
February 13, 2023 14:41
-
-
Save jesseeproductions/065e792824fe5133861164ef0de00cef to your computer and use it in GitHub Desktop.
Adds a custom field to the attendee details sent to Zapier through Event Automator
This file contains 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
/** | |
* Adds a custom field to the attendee details sent to Zapier through Event Automator. | |
* Replace %%CUSTOMFIELD%% with your field name. | |
* | |
* @since 1.0.0 | |
* | |
* @param array<string|mixed> An array of attendee mapped details. | |
* @param array<string|mixed> An array of raw attendee details. | |
*/ | |
function tec_automator_map_attendee_details( array $next_attendee, array $attendee ) { | |
$custom_field = get_post_meta( $attendee['attendee_id'], '%%CUSTOMFIELD%%', true ); | |
if ( ! $custom_field ) { | |
return $next_attendee; | |
} | |
$next_attendee['%%CUSTOMFIELD%%'] = $custom_field; | |
return $next_attendee; | |
} | |
add_filter( 'tec_automator_map_attendee_details', 'tec_automator_attendee_add_custom_field', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment