I'm able to get the data from the $myEmail and $myProject but having difficulty with $myName. The element that I'm trying to get the data from is a drop down and I wanted the name value, but the raw data keeps coming over. Not sure what I'm doing wrong? The element has the name of a person in the name field and the value has their email. Please help.
$myEmail = '{ministry_projects___assigned_raw}';
$myName = '{ministry_projects___assigned}';
$myProject = '{ministry_projects___project}';
if (!empty($myEmail)) {
if (! include_once JPATH_ADMINISTRATOR . '/components/com_acymailing/helpers/helper.php')
{
throw new RuntimeException("Acymailing not installed");
return false;
}
$myUser = new stdClass();
$myUser->email = $myEmail;
$myUser->name = $myName;
$myUser->project = $myProject;
//If you require a confirmation but don't want the user to have to confirm his subscription via the API, you can set the confirmed field to 1:
//$myUser->confirmed = 1;
$subscriberClass = acymailing_get('class.subscriber');
$subid = $subscriberClass->save($myUser);
$newSubscription = array();
$newList = array();
$newList['status'] = 1;
$newSubscription[4] = $newList; // Replace 2 with the ID of the list.
$subscriberClass->saveSubscription($subid,$newSubscription);
}
$myEmail = '{ministry_projects___assigned_raw}';
$myName = '{ministry_projects___assigned}';
$myProject = '{ministry_projects___project}';
if (!empty($myEmail)) {
if (! include_once JPATH_ADMINISTRATOR . '/components/com_acymailing/helpers/helper.php')
{
throw new RuntimeException("Acymailing not installed");
return false;
}
$myUser = new stdClass();
$myUser->email = $myEmail;
$myUser->name = $myName;
$myUser->project = $myProject;
//If you require a confirmation but don't want the user to have to confirm his subscription via the API, you can set the confirmed field to 1:
//$myUser->confirmed = 1;
$subscriberClass = acymailing_get('class.subscriber');
$subid = $subscriberClass->save($myUser);
$newSubscription = array();
$newList = array();
$newList['status'] = 1;
$newSubscription[4] = $newList; // Replace 2 with the ID of the list.
$subscriberClass->saveSubscription($subid,$newSubscription);
}