- Issue created by @camilo.escobar
In recurring_events_reminders_cron, if one of the event instances marked for sending reminders has no registrants, the loop breaks and the remaining instances in the list are left unprocessed. As a result, you must wait until the next cron run, hoping that no other empty instances are encountered, before the reminders for valid instances are eventually processed and notifications are sent.
This happens because the function uses return instead of continue at this point in the code:
recurring_events_reminders/recurring_events_reminders.module
foreach ($instances as $instance) {
$instance->set('reminder_sent', time());
$instance->setNewRevision(FALSE);
$instance->save();
/** @var \Drupal\recurring_events_registration\RegistrationCreationService */
$registration_creation_service = \Drupal::service('recurring_events_registration.creation_service');
$registration_creation_service->setEventInstance($instance);
$registrants = $registration_creation_service->retrieveRegisteredParties();
if (empty($registrants)) {
return; // This breaks the process if an instance has no registrants, leaving remaining instances unprocessed.
}
$key = 'registration_reminder';
// Send an email to all registrants.
foreach ($registrants as $registrant) {
// Add each notification to be sent to the queue.
\Drupal::service('recurring_events_registration.notification_service')->addEmailNotificationToQueue($key, $registrant);
}
}
If an instance does not have registrants, the process should continue with the next instance in the list.
Replace return with continue.
Create MR.
None.
None.
None.
Active
2.0
Recurring Events Reminders (Submodule)