Hello
I am trying to set up an autoaction to automatically add connections of a user to its acymailing list.
The trigger is onAfterAcceptConnection and the code is pretty simple like
Code:
onAfterAcceptConnection
$ds = DIRECTORY_SEPARATOR;
$acyHelper = rtrim(JPATH_ADMINISTRATOR, $ds).$ds.'components'.$ds.'com_acym'.$ds.'helpers'.$ds.'helper.php';
if (!include_once($acyHelper)) {
echo 'This code can not work without the AcyMailing Component';
return false;
}
$userClass = new AcyMailing\Classes\UserClass();
$acyUserId = '[var2_id]';
$joomlaUserId = '[var1_id]';
$managementListId = acym_loadResult('SELECT id FROM #__acym_list WHERE cms_user_id = '.intval($joomlaUserId));
if(!empty($managementListId)){
$userClass->subscribe($acyUserId, $managementListId, true, true);
}
However it fails without any error.
Should I use another trigger ?
Is there another way to achieve this than a code autoaction ?
Acymailing allows users management in front end and my idea was to add any connection to a user's list if he has one (and allowed by CB subs)
Mind to share your ideas ?