Home Forums Event Espresso Premium Infusionsoft Tagging Based on Custom Question Answer

Infusionsoft Tagging Based on Custom Question Answer

Posted: January 21, 2018 at 4:18 pm

Mike Doughty

January 21, 2018 at 4:18 pm


We have used the code for tagging a contact in Infusionsoft based on a custom question answer, and it does not seem to be working.

Here is a screencast showing everything.

How do we get it to tag based on the answer provided in the radio button on the registration form?

Thanks, Mike

Here is the code we’ve used

//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 ‘Yes’ :
$tags[] = 788;
case ‘No’ :
$tags[] = 780;
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_action(‘FHEE__EEE_Infusionsoft_Registration__sync_to_infusionsoft__infusionsoft_tags’, ‘ee_infusionsoft_save_additional_tags’, 10, 2 );

/* Stop Adding Functions */


  • Support Staff

January 24, 2018 at 12:02 pm

Hi Mike,

Your code is checking for Yes or No, but the answers to the question are 1 or 0. These must match for the conditional tag to be applied. I heard in the video where you mentioned you tried 1 and 0, so did you try
case '1' :
or was it
case 1 :

There is a difference between the above two examples.

Also, you can verify that:

  1. the Infusionsoft add-on is activated on your site
  2. Your custom plugin is activated on your site

Lastly, filter hooks should be hooked to with add_filter() instead of add_action(). I think add_action() may work in this case, but it’s technically the wrong function to use when working with WordPress filter hooks.

Mike Doughty

January 25, 2018 at 9:33 pm


The plugin has been active on the site. However I’ve just tried to activate it and it’s coming up with can’t be activated as causing a fatal error.

As the plugin is just code is just using sample code from EE, I’m not sure why that would be happening, as it’s been fine.

Any thoughts?

Thanks, Mike


  • Support Staff

January 26, 2018 at 3:35 am

Hi Mike,

I’m guessing the error your getting is something like:

Parse error: syntax error, unexpected '='

And the reason for that is you’ve changed the code to use a - in the variable name. This:


If I rewrite that just a little so its clear how PHP will parse that:

$answer_to_course - materials

{variable} {minus} {contstant}

Dashes should not be used in variable names as they are used as the subtraction operator, in some case they may appear to be working, say when working with strings, but if you check the error log you’ll see all kind of undefined constant notices.

Change any instances of $answer_to_course-materials to $answer_to_course_materials and retest.

Mike Doughty

January 26, 2018 at 9:16 pm


Thanks for suggestions. I’ve tried doing as you mentioned, however when trying to activate the plugin, I’m still getting the following message.

“Plugin could not be activated because it triggered a fatal error.”

Any thoughts on what needs to be changed to be able to have this code activated?

Thanks, Mike


  • Support Staff

January 27, 2018 at 8:00 am

Can you post the full updated code ( the full plugin code) you are using to and post the url here for us to view.

Also if you look at your server error log you see the full error thrown. Can you post that please.

I’m not getting any errors after I fix the above on the code you posted so need the above.

  • This reply was modified 1 year ago by  Tony.

Mike Doughty

January 31, 2018 at 8:51 pm


Here is the pastebin url.

Where do I find the error logs?

Thanks, Mike


  • Support Staff

February 1, 2018 at 2:17 am

You haven’t fixed the code I mentioned above.

$course-materials_answer and $answer_to_course-materials

Please fix your variable names before you continue as its likely the cause of the errors.

FOr the error logs you’ll usually have a section in your hosts control panel to view logs or look for an error_log file on the server.

Mike Doughty

February 1, 2018 at 7:54 pm


Ok, so I’ve fixed those items, and now I got the following issue

Fatal error: Cannot redeclare ee_infusionsoft_save_my_custom_questions() (previously declared in /nas/content/staging/teo/wp-content/plugins/aw-teo/aw-teo.php:1039) in /nas/content/staging/teo/wp-content/plugins/gbf-admin/gbf-admin-custon.php on line 30

So there is some sort of conflict I’m guessing with the code at line 1039 in the aw-teo.php plugin.

The code on this line is

“function ee_infusionsoft_save_my_custom_questions( $is_contact_data, $ee_attendee ) {”

Do I need to change the code in my gbf-admin-custon plugin to fix the conflict?

Hopefully, we are getting closer to resolving the issue.

Thanks, Mike


  • Support Staff

February 2, 2018 at 2:22 pm

Fatal error: Cannot redeclare ee_infusionsoft_save_my_custom_questions()

You can only have one function with that name, otherwise, PHP doesn’t know which function it should use when you call it.

So you can either, add your additional code to the ee_infusionsoft_save_my_custom_questions function in aw-teo.php or, you can rename the function you are using in gbf-admin-custon.php (if you do that you’ll need to update the filter call back to use the new function name).

Mike Doughty

February 2, 2018 at 2:59 pm


So I’ve put the code into the at the bottom of the aw-teo.php plugin, and removed it from the gbf-admin-custon.php plugin and I’m still getting a similar error.

Fatal error: Cannot redeclare ee_infusionsoft_save_my_custom_questions() (previously declared in /nas/content/staging/teo/wp-content/plugins/aw-teo/aw-teo.php:1038) in /nas/content/staging/teo/wp-content/plugins/aw-teo/aw-teo.php on line 1077

Thanks, Mike


  • Support Staff

February 4, 2018 at 3:15 pm

Because you still have the original function with the same name, as mentioned above, you can’t have 2 functions with the same name as PHP doesn’t know which to run. So you either combine the 2 functions together or rename one of them.

Right now you’ve moved the new function into the same plugin as the old one, they both still have the same name so still cause the same problem.

The support post ‘Infusionsoft Tagging Based on Custom Question Answer’ 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.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Tony 1 year ago ago

Topic Tags


This topic is: not resolved
Do NOT follow this link or you will be banned from the site!