AcyMailing
Back to LATEST versionOur siteForumBlog
Version 5
Version 5
  • AcyMailing 5 documentation
  • Main pages
    • Users
      • Export Users
      • Import Users in AcyMailing
      • Mass actions
    • Lists
      • Distribution lists
      • List: Add/Edit
    • Newsletters
      • A/B Testing
      • Spam Test
      • Schedule your Newsletter
      • Smart-Newsletters
      • Campaigns
      • Joomla notifications
      • Simple Sending
      • Templates
        • Import a template
    • Queue
    • Statistics
      • Click statistics
      • Comparison page
      • Statistics charts
    • Configuration
      • Configuration tabs
        • Configure your send process
          • DKIM : DomainKeys Identified Mail
          • External SMTP service
        • Cron task
        • Geolocation
        • Captcha
        • Google Analytics
        • Forward to a friend
        • Access level
      • Custom fields
      • Bounce Handling
      • Unsubscribe page
  • Public part of your site
    • Configure your Subscription Module
    • Latest Newsletters module
    • Newsletter archive section
    • Front-end Newsletter edition
  • FAQ
    • Insert your subscription form in your article
    • Update AcyMailing 5
    • Your send process is slow?
    • Could not instantiate mail function
    • Sending issue
    • Spam issue
    • Compatibility issues
    • Install / Update issues
  • Integration plugins
    • Installed with AcyMailing
      • Insert Joomla articles in your newsletter
      • Plugin : Statistics
      • Plugin: (auto)Subscribe during Joomla registration
      • Plugin: Call to action
      • Plugin: Date - Time
      • GMail Inbox Actions
      • Plugin: Joomla Module Loader
      • Plugin: Joomla User
      • Plugin: Manage Subscription
      • Share your Newsletter on social networks
      • Plugin: Subscriber
      • Plugin: Website Links
      • AcyMailing plugin : table of contents generator
    • User management
      • Plugin: AltaUserPoints
      • Plugin : VirtueMart Checkout Subscription
      • Plugin: CB User
      • Plugin: CJBlog
      • Plugin: com_contact
      • Plugin: Community Builder
      • Plugin: Easy Profile
      • Plugin: EasySocial
      • Plugin: ExtendedReg Profile Information
      • Plugin: Grumpy Contacts
      • Plugin: Ja Job Board
      • Plugin: JomSocial
      • Plugin: JUGA
      • Plugin: K2 Users
      • Plugin: MightyMembership
      • AlphaUserPoints plugin
    • Content management
      • Plugin : AdsManager
      • Plugin: AdsManager (by Heigho)
      • Plugin : Dj-Catalog 2
      • Plugin : Kunena
      • Plugin: AdAgency
      • Plugin: CiviCRM
      • Plugin: Cobalt
      • plugin: Dj-Classifieds
      • plugin: EasyBlog
      • plugin: EasyDiscuss
      • Plugin: Emerald
      • Plugin: EZautos
      • plugin: FLEXIcontent
      • Plugin: Form2Content
      • Plugin: GMapFP
      • plugin: JoomBlog
      • plugin: Joomla! Estate Agency (JEA)
      • plugin: K2 items
      • Plugin: ListBingo
      • plugin: Lyften Bloggie
      • Plugin: MightyResources
      • Plugin: MosetsTree
      • Plugin: Newsfeeds
      • plugin: SEBLOD 3
      • Plugin: Sobi2
      • Plugin: SobiPro
    • Events
      • plugin: !Cagenda
      • Plugin: DPCalendar
      • Plugin: EventList
      • plugin: Event Booking
      • Plugin: jCalPro Events
      • Plugin: jEvents
      • Plugin: Matukio
      • plugin: MijoEvents
      • Plugin: Ohanah
      • Plugin: redEvent
      • Plugin: RsEvents
      • plugin: RSEvents Pro
    • E-commerce
      • Plugin: Awo Affiliate
      • Plugin: HikaShop
      • plugin: JoomShopping
      • plugin: K2Store
      • Plugin: redSHOP
      • Plugin: MijoShop
      • Plugin: VirtueMart Coupons
      • Plugin: VirtueMart
      • AwoCoupon plugin
    • Subscription system
      • Plugin: AEC
      • Plugin : CBSubs
      • Plugin: Membership Pro
      • Plugin: MightyRegistration
      • Plugin: OSE Membership Control Manager
      • Plugin: Payplans
      • Plugin: AkeebaSubs
      • AEC AcyMailing micro-integration
    • Files management
      • Plugin : RokDownloads
      • Plugin: DOCman
      • plugin: DOCman 2
      • Plugin: Document Media Manager
      • Plugin: jDownloads
      • Plugin: Joomdoc
      • Plugin: PhocaDownload
      • Plugin: Remository
    • Other
      • Module: Statistics dashboard
      • module: Quick icon for J1.5
      • Plugin : Module Article
      • plugin: AcyMailing toolbox
      • plugin: Auto-create a list on user registration
      • plugin: Add CC
      • Plugin: Create Joomla user
      • Plugin: Autotweet NG
      • plugin: Edit notification
      • plugin: Export users in mass action
      • plugin: List owner notification
      • Plugin: Modify user group
      • plugin: Quick icon for J2.5 and J3.X
      • plugin: Search
      • Plugin: Smart Search
      • Plugin: Squeeze Page
      • plugin: Stop Smart-Newsletter during weekend
      • Universal tag plugin
      • Universal filter plugin
      • Birthday Newsletter
  • Developers
    • AcyMailing 5 Developer Documentation
    • Customize the way the content inserted in emails by plugins
    • Conditional display
    • Multiple queue system
    • External subscription form
    • Subscription via URL
      • Fabrik Form and AcyMailing
      • ChronoForm and AcyMailing
      • RSForm!Pro and AcyMailing
      • BreezingForms and AcyMailing
Powered by GitBook
On this page
  • Description
  • Integration with RSForm!Pro
  • Integrate AcyMailing and RSForm!Pro using php code
  • Integrate AcyMailing and RSForm!Pro using Curl
  • Integrate AcyMailing and RSForm!Pro using the redirect URL
  1. Developers
  2. Subscription via URL

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.

$postData = $_REQUEST['form'];
include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_acymailing'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php'); 
$myUser = new stdClass(); 
$myUser->email = strip_tags($postData['email_field']); //Please replace email_field by your own field name (the name of the field "email"). 
$myUser->name = strip_tags($postData['name_field']); //Please replace name_field by your own field name (the name of the field "name"). 
$subscriberClass = acymailing_get('class.subscriber'); 
$subscribe = array(3,4,5); //Specify here the ID of your lists separated by a comma, in this example the user will be subscribed to lists IDs 3,4 and 5.
$_REQUEST['subscription'] = $subscribe; //Only useful when using a subscription condition in the "Create Joomla user" plugin, you can delete this line if you don't use this plugin 
$subid = $subscriberClass->save($myUser);
$subscriberClass->sendConf($subid); //we send the confirmation email... only if needed based on the current user status and the option from the Acy configuration page. 
$newSubscription = array(); 
if(!empty($subscribe)){ 
foreach($subscribe as $listId){ 
$newList = array(); 
$newList['status'] = 1; 
$newSubscription[$listId] = $newList; 
} 
} 
$subscriberClass->saveSubscription($subid,$newSubscription);

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:

$postData = $_REQUEST['form'];
if(empty($postData['subscribeme'])) return;
include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_acymailing'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php'); 
$myUser = new stdClass(); 
$myUser->email = strip_tags($postData['email_field']); //Please replace email_field by your own field name (the name of the field "email"). 
$myUser->name = strip_tags($postData['name_field']); //Please replace name_field by your own field name (the name of the field "name"). 
$subscriberClass = acymailing_get('class.subscriber'); 
$subscribe = array(3,4,5); //Specify here the ID of your lists separated by a comma, in this example the user will be subscribed to lists IDs 3,4 and 5.
$_REQUEST['subscription'] = $subscribe; //Only useful when using a subscription condition in the "Create Joomla user" plugin, you can delete this line if you don't use this plugin 
$subid = $subscriberClass->save($myUser);
$subscriberClass->sendConf($subid); //we send the confirmation email... only if needed based on the current user status and the option from the Acy configuration page. 
$newSubscription = array(); 
if(!empty($subscribe)){ 
foreach($subscribe as $listId){ 
$newList = array(); 
$newList['status'] = 1; 
$newSubscription[$listId] = $newList; 
} 
} 
$subscriberClass->saveSubscription($subid,$newSubscription);

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:

$postData = $_REQUEST['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);

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 4 years ago

​​

Please make sure you successfully tested the subscription via URL before trying to integrate AcyMailing and RSForm!Pro using Curl.