RSForm!Pro and AcyMailing
Description
If you use RSForm!Pro on your website, you can integrate AcyMailing with RSForm!Pro 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 RSForm!Pro
Integrate AcyMailing and RSForm!Pro using php code
You can configure RSForm!Pro to execute this php code to subscribe the user to AcyMailing.
This script should go in the Script called after form has been processed area in RSForm!Pro. You can find this area when editing your form, in the property tab, PHP Scripts part.
Don't forget to replace in the following code the name of the email and name fields by the ones of your form as well as putting the list ID you want to subscribe the users to. See comments in the code below.
You may want to subscribe the user to AcyMailing only if he checks a box to really opt in... If it's the case, you should call your checkbox "subscribeme" and use this php code:
Integrate AcyMailing and RSForm!Pro 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 will explain here a method using the Curl but if your server does not support it or if you want an easier method, you can still use the redirect URL.
Log on to the back-end and click on the menu RSForm!Pro -> Manage Forms.
Select the form you want to integrate with AcyMailing and click on the tab Scripts.
On the area "Script called after form has been processed", copy/paste the following code:
RSForm Script
If you use a recent version of RSForm, the script area is under the tab "Properties" when you edit your form:
Script RSForm
This script will require three fields to work properly.
Click on the tab "Components" to add at least these three fields:
You should add a field with the name "Name".
Name field
The field "Email" should also be added to your form.
Email Field
Then the last field which is required to integrate AcyMailing and RSForm!Pro is the field "hiddenlists". The value of this field will be the IDs of the lists you want the user to be subscribed to. On our example we added it as an hidden field with the value "1,4" so the user will be subscribed to the lists with ID 1 and 4.
Hiddenlists
Integrate AcyMailing and RSForm!Pro using the redirect URL
Please make sure you successfully tested the subscription via URL before trying to integrate AcyMailing and RSForm!Pro 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 system OR the redirect URL, but don't use both solutions!
Log on to the back-end and click on the menu RSForm!Pro -> Manage Forms.
Edit the form you want to integrate with AcyMailing and select the tab "Edit Form".
Redirect url
Specify the Return URL: index.php?option=com_acymailing&ctrl=sub&task=optin&hiddenlists=1,4&user[name]={Name:value}&user[email]={Email:value}
You have to add the values related to your form fields name (so the one specified on the Quick Add tool).
In the url, the parameter hiddenlists=1,4 should be modified by your own lists IDs.
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 : index.php?option=com_acymailing&ctrl=sub&task=optin&hiddenlists=1,4&user[email]={Email:value}&user[name]={Name:value}&redirect=http://www.google.fr
Last updated