ChronoForm and AcyMailing
Description
If you use ChronoForm on your website, you can integrate AcyMailing with ChronoForm so that when a user submits a form, this user is also subscribed to one or several AcyMailing Lists.
There are three ways to do this. The recommended method is to use php code to add the user after the form is submitted.
Integration with ChronoForm
Integrate AcyMailing and ChronoForm using a PHP script
You can configure ChronoForm to execute this php code to subscribe the user to AcyMailing.
Don't forget to replace email_field and name_field by your own fields name and to enter the IDs of your lists instead of 3,4,5
Chronoform step 1
Chronoform step 2
Chronoform step 3
Chronoform step 4
Integrate AcyMailing and ChronoForm using Curl
Once you tested your subscription via URL, you want the fields name and e-mail to be automatically replaced by the information sent in the form.
We recommend you to use the Curl method to do that but if your server does not support it, you can still use the redirect URL.
Log on to the back-end and click on the menu Chrono Forms -> Forms Management.
Select the form you want to integrate with AcyMailing and click on CURL.
ChronoForm Curl
Click on the tab CURL params and enter the Target URL : http://www.yourwebsite.com/index.php?option=com_acymailing
Don't forget to replace www.yourwebsite.com by the url of your own website!
Curl Params
Click on the tab General and enter the AcyMailing equivalent for each field you want to send to AcyMailing.
Please enter user[email] for the field email.
Please enter user[name] for the field name.
In the area Extra fields Data, please enter the text:
ctrl=sub task=optin hiddenlists=1,4
(replace hiddenlists=1,4 by the lists ID you want your user to be subscribed to)
Curl General
Save the CURL plugin.
You should now enable this CURL plugin for your form.
Edit your form
Click on the tab Plugins
Click on the CURL plugin to enable it (it should be green to be activated)
CURL enable
You can now test from the front-end. If you have any problem, please turn ON the CURL debug mode (in the tab CURL params) so you will see some debug traces when you submit your form.
Curl method with ChronoForm v4
With Chronoform 4, the subscription via curl will look like that:
ChronoForm v4
You should replace {name} and {email} by your own field value from ChronoForm but leave the user[name] and user[email] intact.
Integrate AcyMailing and ChronoForm using the redirect URL
Once you tested your subscription via URL, you want the fields name and e-mail to be automatically replaced by the information sent in the form.
You can use the CURL plugin OR the redirect URL, but don't use both solutions! You might want to use the redirect URL in case the PHP Curl function is not enabled on your website.
Log on to the back-end and click on the menu Chrono Forms -> Forms Management.
Edit the form you want to integrate with AcyMailing (click on its name).
Click on the tab Form Code and add this code in the area On Submit code - after sending email :
In our example we kept the default field names but you might have to change item_1 and item_2 by your own field names (based on what you wrote in the Form Wizard).
In the url, the parameter hiddenlists=1,4 should be modified by your own lists IDs.
ChronoForm Code
Save the form.
Test this form on your front-end and make sure the user is added and subscribed properly to AcyMailing.
Then, you can add a redirect link to the AcyMailing subscription url so that the user will be redirected to your own thank you page.
Example : $MyForm->formrow->redirecturl = JURI::base()."index.php?option=com_acymailing&ctrl=sub&task=optin&hiddenlists=1,4&user[email]=$email&user[name]=$name&redirect=http://www.google.fr";
If you want to reach an external website, you should write your complete url and don't use JURI:base():
Example : $MyForm->formrow->redirecturl = "http://www.myotherwebsite.com/index.php?option=com_acymailing&ctrl=sub&task=optin&hiddenlists=1,4&user[email]=$email&user[name]=$name&redirect=http://www.google.fr";
Last updated