Dear Tihana,
The old code block which was meant for Acymailing 5.x does not work with the Acymailing 7.8.3.
There has happened some changes in their coding. I have used the following NEW code block to work with newer version of it
$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 = strip_tags(ff_getSubmit('email')); //Please replace email_field by your own field name (the name of the field "email").
$myUser->name = strip_tags(ff_getSubmit('name')); //Please replace name_field by your own field name (the name of the field "name").
$userClass = acym_get('class.user'); // This has changed for Acymailing 6 and 7.x.x
$subid = $userClass->save($myUser);
$subscribe = array(2,3); //Specify here the ID of your lists separated by a comma, in this example the user will be subscribed to lists IDs 2 and 3
$newSubscription = array();
$subscriberClass->sendConf($subid);
if(!empty($subscribe))
{
foreach($subscribe as $listId)
{
$newList = array();
$newList['status'] = 1;
$newSubscription[$listId] = $newList;
}
}
$userClass->subscribe($subid, $subscribe);
//Section Ends Here
Source: forum.acymailing.com/d/92-acymailing6-and-breezingforms/7 forum.acymailing.com/d/207-php-scripts-w...d-acymailing-v6-x/28
I have succeeded in passing the name and email to Acymaling, but failed to get the user subscribed to the given lists.
There seems some error in the above code block....
1. Could please help me in fixing the error?
There was one more code, as given below:
$userClass = acym_get('class.user');
$myUser = $userClass->getOneByEmail(strip_tags($postData['Email'])); // change value between brackets and single quotes to your email address fieldname
// check if email address already exists
if (empty($myUser)) {
$myUser = new stdClass();
}
2. Can this code block to check if email address already exists, be used along with our code?
Kindly help
With thanks,
RK