• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Acymailing 6

Acymailing 6 3 years 9 months ago #40335

Hi..

I would like to know the correct code to apply in Acymailing 6 x Rsform integration
$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']);
 $myUser->name = strip_tags($postData['nome']);
 $myUser->sobrenome = strip_tags($postData['sobrenome']);
 $myUser->telefone = strip_tags($postData['Telefone']);
 $myUser->celular = strip_tags($postData['Celular']);
 $subscriberClass = acymailing_get('class.subscriber');
 
 $subscribe = array(4);
$_REQUEST['subscription'] = $subscribe;
 
 $subid = $subscriberClass->save($myUser);
 
 
$subscriberClass->sendConf($subid);
 
 $newSubscription = array();
 if(!empty($subscribe)){
 foreach($subscribe as $listId){
 $newList = array();
 $newList['status'] = 1;
 $newSubscription[$listId] = $newList;
 }
 }
 $subscriberClass->saveSubscription($subid,$newSubscription);

Itried this but its to Acymailing 5

Thanks in advance
The administrator has disabled public write access.

Acymailing 6 3 years 3 months ago #40895

Acymailing 6 have not name com_acymailing but com_acym, do you know?
The administrator has disabled public write access.

Acymailing 6 2 years 5 months ago #41641

  • nathan82
  • nathan82's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
For anyone that comes looking for some code to subscribe people to ACYMailing v6 or v7 this code can be placed in the 'Script called after Form processed'.

The default list name can be set in the Form or uncomment to hard code in the script. Also enabled to allow you to select other lists for subscription in the form from checkboxes, see comments.
/*=================================================
 * Subscribe to ACYMailing v6/7 list(s).
 *================================================= */
 
    include_once(JPATH_ADMINISTRATOR . '/components/com_acym/helpers/helper.php');
    $userClass = acym_get('class.user');
 
    // Get form data
    $postData = $_REQUEST['form'];
 
    $name       = strip_tags($postData['name']);   // change value to field on form containing subscribers name.
    $email      = strip_tags($postData['email']);  // change value to field on form containing email address.
    $lists[]    = $postData['default_list'];       // Subscribe to list # in hidden field called default_list.
    //  $list[]     = '42';                          // Hardcode the list # here rather than in field in form.
 
    /*  Remove this section of code if you Do Not have other lists that can be subscribed to by checking a box.
     *  Requires 'list#|visible text' added to the Items field of the checkbox field.
     */
    $lists_optional  = $postData['other_lists'];         // change value to checkbox field list of optional Newsletters.
    if(!empty($lists_optional))
    {
        $lists[] = implode(',',$lists_optional);
    }
    // End of optional section that can be removed if not required
 
    // check if email address already exists
    $myUser = $userClass->getOneByEmail($email);
    if (empty($myUser))
    {
        $myUser = new stdClass();
    }
 
    //Add or Update the User to ACYMailing
    $myUser->email  = $email;
    $myUser->name   = $name;
    $myUser->id     = $userClass->save($myUser);
 
    // Attempt subscription
    $userClass->subscribe($myUser->id, $lists);
/*=================================================
 * end of : Subscribe to ACYMailing list(s)
 *================================================= */

Terry
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!