Answer the question
In order to leave comments, you need to log in
Is there an event for adding a new subscriber in the bitrix:sender.subscribe component?
Good day!
The site contains the bitrix:sender.subscribe component - the subscription form. The user enters his e-mail into it, presses "Subscribe" - and as a result I can see his e-mail in the Address List (Administration->Marketing->Email-marketing->Address List).
Question - is there any event in Bitrix that can be used to catch the moment a new subscription is added to this list? I can’t find any clues in the Bitrix documentation. Unless some 3 events are mentioned on this page:
https://dev.1c-bitrix.ru/api_d7/bitrix/sender/subs...
But somehow I couldn't use them.
I also tried to apply a code snippet found on the Bitrix forum:
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->addEventHandlerCompatible('crm', '\\Bitrix\\Sender\\Contact::onBeforeAdd', ['myEvents','onBeforeAddHandler']);
Answer the question
In order to leave comments, you need to log in
The bitrix:sender.subscribe component adds a mailing list subscription using the \Bitrix\Sender\Subscription::add method.
Inside the method, first, the presence of the transmitted email in the contact database is checked, and if EMAIL is not there, then it is added. And after adding a subscription to the specified mailing lists.
Adding a contact occurs in the ORM table Bitrix\Sender\ContactTable
Subscribing to the Bitrix\Sender\MailingTable mailing list You can
subscribe to an event like this:
$eventManager = Main\EventManager::getInstance();
$eventManager->addEventHandler(
"sender",
"\Bitrix\Sender\ContactTable::onAfterAdd",
['myEvents','onBeforeAddHandler']
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question