public function SubscriptionManager::sendConfirmations in Simplenews 8.2
Same name and namespace in other branches
- 8 src/Subscription/SubscriptionManager.php \Drupal\simplenews\Subscription\SubscriptionManager::sendConfirmations()
- 3.x src/Subscription/SubscriptionManager.php \Drupal\simplenews\Subscription\SubscriptionManager::sendConfirmations()
Send confirmations for previous subscription and unsubscription requests.
Return value
int The number of confirmations that were sent.
Overrides SubscriptionManagerInterface::sendConfirmations
1 call to SubscriptionManager::sendConfirmations()
- SubscriptionManager::destruct in src/
Subscription/ SubscriptionManager.php - Performs destruct operations.
File
- src/
Subscription/ SubscriptionManager.php, line 236
Class
- SubscriptionManager
- Default subscription manager.
Namespace
Drupal\simplenews\SubscriptionCode
public function sendConfirmations() {
foreach ($this->confirmations as $mail => $changes) {
$subscriber = Subscriber::loadByMail($mail, 'create', $this->languageManager
->getCurrentLanguage());
$subscriber
->setChanges($changes);
$this->mailer
->sendCombinedConfirmation($subscriber);
// Save changes in the subscriber if there is a real subscriber object.
if ($subscriber
->id()) {
$subscriber
->save();
}
}
$sent = !empty($this->confirmations);
$this->confirmations = [];
return $sent;
}