I have the code from here ( https://forum.acymailing.com/d/207-php-scripts-with-rsform-and-acymailing-v6-x ) working fine for one person to be subscribed to 1 or multiple lists, however, we would like to subscribe based on a checkbox to one list only.
The code I have shows the correct box has been checked but does not subscribe the user to the list. Any suggestions would be nice.
$this->execPieceByName('ff_InitLib');
$listType = ff_getSubmit('subscribecheckboxes');
switch ($listType) {
case 'list2':
$subscribe = array(2);
break;
case 'list3':
$subscribe = array(3);
break;
case 'list4':
$subscribe = array(4);
break;
case 'list5':
$subscribe = array(5);
break;
case 'list6':
$subscribe = array(6);
break;
case 'list7':
$subscribe = array(7);
break;
case 'General Interest':
$subscribe = array(1);
break;
default:
break;
} return;
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');
$myUser->name =ff_getSubmit('name');
$userClass = acym_get('class.user');
$subid = $userClass->save($myUser);
$subscribe = array(1,2,3,4,5,6,7);
$newSubscription = array();
if(!empty($subscribe)){
$userClass->subscribe($subid, $subscribe);
}