TOPIC:

BreezingForms and AcyMailing 7 months 2 days ago #256151

  • Topic Author
  • poldi171254
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 80
  • Thanks: 0
We have been using BreezingForms and AcyMailing for a while where when a new user signs up, they can choose to subscribe to a news letter.

For version 5 of AcyMailing this was achieved by including the following code to the End Submit piece
// AcyMailing

$this->execPieceByName('ff_InitLib');
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(ff_getSubmit('email_repeat'));        //Please replace email_field by your own field name (the name of the field "email").
 $myUser->name = strip_tags(ff_getSubmit('username'));            //Please replace name_field by your own field name (the name of the field "name").
 $subscriberClass = acymailing_get('class.subscriber');
 $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.

 $subscribe = array(2); //Specify here the ID of your lists separated by a comma.

$newSubscription = array();
 if(!empty($subscribe)){
       
       
       	   foreach($subscribe as $listId){
                 $newList = array();
                 if (ff_getSubmit('SubscribeNewsletter')!=''){
                      $newList['status'] = 1;
                 }
                 else { 
                      $newList['status'] = 0;
                 }                
                 $newSubscription[$listId] = $newList;
                 }
       
 }
 $subscriberClass->saveSubscription($subid,$newSubscription);

Since the upgrade to version 7 of AcyMailing and the changes to their API, the above code doesn't work any longer. Does anybody have an example that works with version 7?
Thanks,

Please Log in or Create an account to join the conversation.

BreezingForms and AcyMailing 7 months 2 days ago #256162

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 7381
  • Karma: 3
  • Thanks: 529
Hi,

hmm..I am not tested this yet on version 7.
But could you please see if there appears any errors?

Regards,
Tihana

Please Log in or Create an account to join the conversation.

BreezingForms and AcyMailing 7 months 2 days ago #256216

  • Eddy.vh's Avatar
  • Eddy.vh
  • Online
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 664
  • Karma: 4
  • Thanks: 112
Hello.

Try the code for Acy Mailing 6

www.breezingforms.eddy-vh.com/pas-a-pas/...et-acymailing-2-en-1

In frech but you can use a Translation.

Regards.
Eddy

Please Log in or Create an account to join the conversation.

BreezingForms and AcyMailing 7 months 2 days ago #256230

  • Topic Author
  • poldi171254
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 80
  • Thanks: 0
The code in french looks pretty much identical to what I have (posted) and doesn't work in 7

This is what I got from support

Hi,

we have changed the API calls in version 7 (and version 6 before that)
docs.acymailing.com/developers/acymailin...eloper-documentation

Version 5 and version 7 are completely different extensions and subscription in one doesn't mean that you will have the same subscription in another

Regards


I'm no php guru, but I think what's needed is along the lines of this; not sure how to test, though
use AcyMailing\Classes\UserClass;
​
$subscribe = [2,4,6]; // Id of the lists you want the user to be subscribed to (can be empty)
$unsubscribe = [1,3]; // Id of the lists you want the user to be unsubscribe from (can be empty)
$acyUserId = '23'; // you can use the previous example code to get the user by its site user id or its email address
 
$userClass = new UserClass();
 
if(!empty($subscribe)){
    $userClass->subscribe($acyUserId, $subscribe);
}
 
if(!empty($remove)){
    $userClass->unsubscribe($acyUserId, $unsubscribe);
}

Please Log in or Create an account to join the conversation.

Last edit: Post by poldi171254.

BreezingForms and AcyMailing 7 months 1 day ago #256235

  • Eddy.vh's Avatar
  • Eddy.vh
  • Online
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 664
  • Karma: 4
  • Thanks: 112
Hello.

On my site, I offer the code for acy 5 AND 6, are you sure you entered the code for version 6?

Regards,
Eddy

Please Log in or Create an account to join the conversation.

BreezingForms and AcyMailing 7 months 1 day ago #256314

  • Topic Author
  • poldi171254
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 80
  • Thanks: 0
I'm using version 7, and need help with getting that version to work with the form I have

Please Log in or Create an account to join the conversation.

Moderators: ForumSupport
Time to create page: 0.052 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!