TEMA:

Passing values to Acymailing Enterprise 7.8.3 7 meses 6 días antes #275555

  • Autor del tema
  • Rajneesh
  • Fuera de línea
  • Navegador Senior
  • Navegador Senior
  • Registered
  • Mensajes: 103
  • Gracias recibidas: 0
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

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Passing values to Acymailing Enterprise 7.8.3 7 meses 4 días antes #275559

  • Avatar de tihana.krivic
  • tihana.krivic
  • Fuera de línea
  • Moderador
  • Moderador
  • Registered
  • Mensajes: 12079
  • Gracias recibidas: 779
Hi,

did you try instead of this code:
if(!empty($subscribe))
 	{
 	foreach($subscribe as $listId)
 		{
 		$newList = array();
 		$newList['status'] = 1;
 		$newSubscription[$listId] = $newList;
 		}
 	}
this:
if(!empty($subscribe)){
$userClass->subscribe($subid, $subscribe);
}
Also, do you have a "subscribe to the newwsletter" ?
E.g. this can be a checkbox

Regards,
Tihana

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Passing values to Acymailing Enterprise 7.8.3 7 meses 4 días antes #275585

  • Autor del tema
  • Rajneesh
  • Fuera de línea
  • Navegador Senior
  • Navegador Senior
  • Registered
  • Mensajes: 103
  • Gracias recibidas: 0
Dear Tihana,

It looks like that following code is working and may be a final solution...
// 2 //The following section is meant for directly passing the NAME, and EMAIL fields to selected lists in ACYMAILING

$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)){
$userClass->subscribe($subid, $subscribe);
}
//Section Ends Here

First test has worked and I would wait a little more time to see if everything works well.

With thanks,

RK

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Passing values to Acymailing Enterprise 7.8.3 7 meses 3 días antes #275591

  • Avatar de tihana.krivic
  • tihana.krivic
  • Fuera de línea
  • Moderador
  • Moderador
  • Registered
  • Mensajes: 12079
  • Gracias recibidas: 779
Hi,

super :)

if you need anything else, feel free to ask

Regards,
Tihana

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

  • Página:
  • 1
Moderadores: ForumSupport
Tiempo de carga de la página: 0.049 segundos

Live Support Chat Opened!

Join our Discord chat here and enter the Crosstec channels to receive live support and talk directly to the team!