-
-
Save joshfeck/3fb137494e100abc925c to your computer and use it in GitHub Desktop.
Pass event date and event name as custom fields to Infusionsoft. From https://eventespresso.com/topic/infusionsoft-bring-in-the-event-name-into-a-custom-field/
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
<?php | |
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file | |
function ee_infusionsoft_pass_event_start_and_name( $is_contact_data, $ee_attendee ) { | |
if( $ee_attendee instanceof EE_Attendee ) { | |
$startdate = ''; | |
$eventname = ''; | |
$checkout = EE_Registry::instance()->SSN->checkout(); | |
if ( $checkout instanceof EE_Checkout ) { | |
$transaction = $checkout->transaction; | |
if ( $transaction instanceof EE_Transaction ) { | |
foreach ( $transaction->registrations() as $registration ) { | |
if ( $registration instanceof EE_Registration ) { | |
$event = $registration->event(); | |
if ( $event instanceof EE_Event ) { | |
//get the event start date | |
$startdate = date( EED_Infusionsoft::IS_datetime_format, $event->primary_datetime()->get_raw( 'DTT_EVT_start' ) ); | |
//get the event name | |
$eventname = $event->name(); | |
$is_contact_data[ '_yourISfieldfordate' ] = $startdate; | |
$is_contact_data[ '_yourISfieldforeventname' ] = $eventname; | |
} | |
} | |
} | |
} | |
} | |
} else { | |
EE_Error::add_error(sprintf( __( 'ee_infusionsoft_save_my_custom_questions was not called with an EE_Attendee but a %s', 'event_espresso' ), gettype( $ee_attendee )), __FILE__, __FUNCTION__, __LINE__ ); | |
} | |
return $is_contact_data; | |
} | |
add_filter( 'FHEE__EED_Infusionsoft__save_infusionsoft_attendee__extra_attendee_data', 'ee_infusionsoft_pass_event_start_and_name', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment