Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 0 Ответов
  • 592 Просмотров
*

Bangoo

  • Осваиваюсь на форуме
  • 45
  • 0 / 0
  • Пишу сайты на мантрах
Интеграция с AcyMailing
« : 27.02.2021, 13:28:21 »
Пробовал совместить форму подписки на RSForm с AcyMailing как указано в документации:
https://docs.acymailing.com/setup/subscription-to-your-lists/rsform-pro-integration
Код
Код
// Load the AcyMailing library
$postData = $_REQUEST['form'];
$ds = DIRECTORY_SEPARATOR;
include_once rtrim(JPATH_ADMINISTRATOR, $ds).$ds.'components'.$ds.'com_acym'.$ds.'helpers'.$ds.'helper.php';
$userClass = new AcyMailing\Classes\UserClass();

// Build the user based on your form's fields
$myUser = new stdClass();
$myUser->email = strip_tags($postData['EMAIL_FIELD']);
$myUser->name = strip_tags($postData['NAME_FIELD']);

// If the user already exists update it
$existingUser = $userClass->getOneByEmail($postData['EMAIL_FIELD']);
if (!empty($existingUser)) $myUser->id = $existingUser->id;

// You can add as many extra fields as you want if you already created them in AcyMailing
$customFields = [];
$customFields[CUSTOM_FIELD_ID] = $postData['MY_FIELD']; // the custom field id can be found in the Custom fields list of the AcyMailing admin page


$userClass->sendConf = true; // Or false if you don't want a confirmation email to be sent
$userId = $userClass->save($myUser, $customFields);


// The user now exists in AcyMailing, let's add some list subscriptions
$subscribe = [2,5,6]; // Ids of the lists you want the user to be subscribed to need to be added in this array
$userClass->subscribe($userId, $subscribe);
не работает. Не добавляются данные в БД.
Какие только значения из формы не подставлял в код (и наименование и описание) но в лист рассылки данные не добавляются, кто знает в чем может быть проблема?
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Интеграция Acymailing и RSForm

Автор Bangoo

Ответов: 1
Просмотров: 2444
Последний ответ 27.02.2021, 14:37:46
от Bangoo