• Solved
  • Acymailing6 and BreezingForms

Hello.

With Acymailing 5, it was possible to offer users subscription to the newsletter from a form BreezingForms and it worked very well.
This same form no longer works with version 6 of Acymailing. Is there an adaptation of the script piece so that the form can work with version 6?

Thank you in advance for your help.
Regards,
Eddy

Bonjour.

Avec Acymailing 5, il était possible de proposer aux utilisateurs la souscription à la newslettre depuis un formulaire BreezingForms et ça fonctionnait très bien.
Ce même formulaire ne fonctionne plus avec la version 6 d'Acymailing. Existes-t-il une adaptation de la pièce de script afin que le formulaire puisse fonctionner avec la version 6 ?

Merci d'avance pour votre aide.
Cordialement,
Eddy

$this->execPieceByName('ff_InitLib');

include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_acym'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php');

$myUser = new stdClass();
$myUser->email =ff_getSubmit('email_field'); //Please replace email_field by your own field name (the name of the field "email").
$myUser->name =ff_getSubmit('name_field'); //Please replace name_field by your own field name (the name of the field "name").

$userClass = acym_get('class.user');
$subid = $userClass->save($myUser);

$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.
$newSubscription = array();
if(!empty($subscribe)){
$userClass->subscribe($subid, $subscribe);
}

This should do the job 😉

Hello.

Thank you for your help. 😉
I think it is missing the sending of the confirmation email but I will test this script as soon as possible and I think I see how to send the confirmation email.

Hmmmm. There must be a problem, it does not work with my simple test form.

@Eddy.vh#308
I change Alexandre's post and now it should work 😉
The confirmation email is sent automatically when a new user is created and if you set send confirmation email in the configuration.

Hi Remi.

Thank you for this change, it works now.
With a checkbox to join the newsletter the code gives this:

$this->execPieceByName('ff_InitLib');
if(!ff_getSubmit('subscribeme')) return; // utilisation d'un case a cocher (checkbox) pour adherer à la NL
include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_acym'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php');
$myUser = new stdClass();
$myUser->email =ff_getSubmit('email'); // Nom du champ email
$myUser->name =ff_getSubmit('name'); // Nom du champ Nom
$userClass = acym_get('class.user');
$subid = $userClass->save($myUser);
$subscribe = array(2); // id de listes séparées par une virgule
$newSubscription = array();
if(!empty($subscribe)){
$userClass->subscribe($subid, $subscribe);
}

Thank you both for the help.
Regard,
Eddy

@Eddy.vh#320
Thanks for share it!
I'm glad that I could help you 🙂

a year later

Hello,
I just found this topic in the forum.
I use it and it works fine and I could add custom text fileds but i would like to load Acymailing any type of custom fields used in Breezing forms also.
Either, text field value, check box field values, list field values etc.
Is that possible and How ? Could not find in the doc or forums
Thanks for any help
Phil