Posted: June 20, 2018 at 12:38 pm
I have added a checkbox field to the “Personal Information” Question Group, asking if a user wants to sign up to the ConstantContact email list for that event. I have the PHP knowledge to create the ConstantContact integration using their API, but I don’t know where the custom PHP code should go within EE to pick up whether the checkbox was checked or not. Is there a hook/filter that I can tap into in my child theme that executes when the registration form is submitted? |
|
Hi, You could use either of the following action hooks:
I can advise to add the custom code into its own plugin for the purpose of better organized code. Also if you ever switch themes that will be one less chunk of code to move over. More info here: |
|
Thank you, Josh. In my callback function, what the are parameters I need to pass to it to get the registration information (name, email, etc.) and the event ID? |
|
It will depend on which hook you end up using. You can check the source files for those hooks to see the available parameters. Along with that, I can recommend reviewing the source files of the MailChimp add-on because you’ll be replicating the functionality of that plugin. The main difference is you’ll be making API calls to ConstantContact instead of the MailChimp API. |
|
I’m trying to verify that I’m getting the registration information with the following code: function cc_integration( EE_Registration $registration, $valid_data = array() ){ However, I’m not getting the output written to testreg.txt even with full write permissions on the testreg.txt. Is my approach correct to capture the registration information and is there a better way to test the action? |
|
Are you adding that code to a custom function plugin? If you view your server’s error logs when using the above, you’ll see a fatal error. You are currently casing the first parameter to be an EE_Registration object, but its not:
This is the action within core:
Thats from within the The best way to follow how to use that hook is to take a look at the MaiLChimp add-on, that hooks in with |
|
The support post ‘ConstantContact integration’ 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.