Problem/Motivation
When using the "Series Registration" option for events -- someone registers once for all instances in a series -- our client would like any emails sent to the registrants to mention all of the instance dates in the series. There is currently no token to provide this information. There is [eventseries:]
Use case is primarily for registration confirmation emails so that the registrants can see a complete list of all events in a series for which they have registered.
The token would also be useful for other emails such as registration reminders and emails sent via the registrant list contact form.
Steps to reproduce
Edit emails for events such as "Registration Confirmation" and see there is no token corresponding to all event instances in a series with "Series Registration" enabled.
Proposed resolution
I would appreciate community feedback. I can see some different approaches:
1) a new token that checks to see if the event series has "Series Registration" enabled. If it does, then this token lists all the event instance dates in the series. If not "Series Registration," then this token lists only the event instance date for which the registrant is registered. This allows this single token to be used generically in all emails and adapts itself to the event settings.
2) a new token that doesn't check to see if the event series has "Series Registration" enabled. It always lists all of the event instance dates in a series and it is up to the admin writing the email to decide whether to use this token or not.
3) a whole separate email configuration called "Series Registration Confirmation" that is used only for event series with "Series Registration" enabled. So when someone registers for this type of series, they receive the "Series Registration Confirmation" email instead of the regular "Registration Confirmation" email. This would allow the language in each email to be slightly different and admins do not have to update the emails on a case-by-case basis if used in combination with 2) above.
I prefer going with approach 3 as I think it would help my users to be able to write the contents of the confirmation email slightly different for "Series Registration" events.
Does anyone have any thoughts? I am available to do this work.
Issue fork recurring_events-3572451
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
chrisla commentedComment #3
chrisla commentedI have successfully created my own token for listing event instances that I can use in notifications.
I dove into the available hooks and found that hook_recurring_events_registration_send_notification_alter() allowed me to add my own notification types to the Registrant settings form. That's awesome.
But then, I found no way to use my custom notifications anywhere during the registration process.
hook_recurring_events_registration_message_params_alter() allows us to alter the $params used in sending the email notifications. But in order to actually send my custom notification, I need access to the $key that is passed to recurring_events_registration_send_notification() that actually sends the notifications.
I have used a sort-of hack to use hook_recurring_events_registration_send_notification_alter() where I can set $send_mail to FALSE and stop the default notification from being sent based on my conditions. Then within that hook, I can send my own email notification instead.
It feels like another hook could be used inside recurring_events_registration_send_notification() to allow the $key of the email notification to be altered. I will post an example.
Comment #5
chrisla commentedSee the above MR for a suggestion of how a new hook could allow modifying the mail $key before sending notifications in conjunction with using hook_recurring_events_registration_send_notification_alter() to add custom notification types.