Add an option for sending admin notification

[MAILPOET-2042]
This commit is contained in:
Pavel Dohnal
2019-05-28 13:16:38 +02:00
committed by M. Shull
parent a64aff6728
commit c4a086ba29
2 changed files with 35 additions and 6 deletions

View File

@ -89,6 +89,7 @@ class API {
function subscribeToLists($subscriber_id, array $list_ids, $options = []) {
$schedule_welcome_email = (isset($options['schedule_welcome_email']) && $options['schedule_welcome_email'] === false) ? false : true;
$send_confirmation_email = (isset($options['send_confirmation_email']) && $options['send_confirmation_email'] === false) ? false : true;
$skip_subscriber_notification = (isset($options['skip_subscriber_notification']) && $options['skip_subscriber_notification'] === true) ? true : false;
if (empty($list_ids)) {
throw new \Exception(__('At least one segment ID is required.', 'mailpoet'));
@ -153,6 +154,10 @@ class API {
}
}
if (!$skip_subscriber_notification) {
$this->sendSubscriberNotification($subscriber, $found_segments_ids);
}
return $subscriber->withCustomFields()->withSubscriptions()->asArray();
}