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 );
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:
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.
Support forum for Event Espresso 3 and Event Espresso 4.