RSForm!Pro and AcyMailing
DescriptionIf 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. This method requires the AcyMailing subscription via URL (available from AcyMailing Essential on). This documentation has been written with the help of Arjen Schrijvers.
Integration with RSForm!ProTest the subscription via URLIntegrate AcyMailing and RSForm!Pro using CurlOnce 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:
$postData = JRequest::getVar('form');
@ini_set('user_agent', 'My-Application/2.5');
@ini_set('allow_url_fopen', '1');
$url = rtrim(JURI::root(),'/').'/index.php?option=com_acymailing&ctrl=sub&task=optin&hiddenlists={hiddenlists}&user[name]={name}&user[email]={email}';
$replace = array();
foreach($postData as $id => $oneVal){
if(is_string($oneVal)) $replace['{'.strtolower($id).'}'] = urlencode($oneVal);
else $replace['{'.strtolower($id).'}'] = urlencode(implode(',',$oneVal));
}
$url = str_replace(array_keys($replace),$replace,$url);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
curl_close($ch);
This script will require three fields to work properly. Click on the tab "Components" to add at least these three fields:
Integrate AcyMailing and RSForm!Pro using the redirect URLOnce 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".
Specify the Return URL: 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 on Wednesday, 26 October 2011 09:35
|









