Support

Home Forums Event Espresso Premium Tagging Based on Custom Question

Tagging Based on Custom Question

Posted: April 18, 2018 at 3:00 am

Viewing 1 reply thread


Mike Doughty

April 18, 2018 at 3:00 am

Hi,

We are using EE4 on the site
http://events.teotraining.co.nz/events/understanding-working-for-families-tax-credits-2018-ellerslie/?register=0&skip_details=1

And we are using the code below to tag based on the custom question Course Material Required. However this does not seem to be working.

Can you please let me know what the issue is with the code.

“/**
* Adds an Infusionsoft tag to an Infusionsoft contact dynamically based
* on a registration’s answer to the ‘gender’ question
* @param array $tags
* @param EE_Registration $registration
* @return array
*/
function ee_infusionsoft_save_additional_tags( $tags, $registration ) {

//assign to group based on the question with admin label “course-materials”
if( $registration instanceof EE_Registration ){
$answer_to_course_materials = EEM_Answer::instance()->get_one( array( array( ‘REG_ID’ => $registration->ID(), ‘Question.QST_admin_label’ => ‘course-materials’ ) ) );
if( $answer_to_course_materials instanceof EE_Answer) {
switch( $answer_to_course_materials->value() ){
case ‘1’ :
$tags[] = 788;
break;
case ‘2’ :
$tags[] = 790;
break;
}
}
}else{
EE_Error::add_error( sprintf( __( ‘The registration variable must be a proper EE_Registration, but was instead a %s’, ‘event_espresso’ ), gettype( $registration ) ), __FILE__, __FUNCTION__, __LINE__ );
}
return $tags;
}
add_filter(‘FHEE__EEE_Infusionsoft_Registration__sync_to_infusionsoft__infusionsoft_tags’, ‘ee_infusionsoft_save_additional_tags’, 10, 2 );

/* Stop Adding Functions */”


Josh

  • Support Staff

April 18, 2018 at 4:27 pm

Hi Mike,

No code is necessary for this. If you have the current version of the Infusionsoft add-on you can use the UI to tag based on a custom question. There’s more info in the documentation:

https://eventespresso.com/wiki/infusionsoft-integration/#ee4-conditional-tagging

Viewing 1 reply thread

The support post ‘Tagging Based on Custom Question’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso