- πΊπΈUnited States phillamb168
The patch in #9 partially solved my issue. However I'm now running across the following behavior:
Config:
registration_notification:
enabled: true
subject: "You've Successfully Registered"
body: "Your registration for [eventseries:title] was successful.\r\n\r\n[eventseries:field_revent_confirmation_text]"registration_reminder:
enabled: true
subject: 'Upcoming Event Reminder'
body: '[eventseries:reminder_message]'Patch from #9 applied.
Behavior:
Tokens are correctly replaced for both emails.Registration reminders are sent correctly as full html.
Registration notifications have their HTML stripped.
Any help would be greatly appreciated.
- πΊπΈUnited States phillamb168
After some weekend work I still couldn't figure out why the token replacement would break on reminder vs. registration. If I used replacePlain() it would work for one but not the other, and if I used replace() it would work for the reverse. Then I realized I had different token names in place for each, so I just modified the patch for a customized if statement, looking at the name of the token and performing the appropriate replace function, e.g.:
diff --git a/modules/recurring_events_registration/src/NotificationService.php b/modules/recurring_events_registration/src/NotificationService.php index ac30381..64798fc 100644 --- a/modules/recurring_events_registration/src/NotificationService.php +++ b/modules/recurring_events_registration/src/NotificationService.php @@ -431,7 +431,15 @@ class NotificationService { ]; // Double token replace to allow for global token replacements containing // tokens themselves. - return $this->token->replace($this->token->replace($string, $data), $data); + // Check to see if the string contains 'reminder_message'. If so, use replacePlain. + // if not, use double replace as before. + // This is to avoid HTML entity encoding of the reminder message. + if (strpos($string, '[eventseries:reminder_message]') === false) { + return $this->token->replace($this->token->replace($string, $data), $data); + } + // Use replacePlain for non-HTML strings to avoid HTML entity encoding. + $tokenized_data = $this->token->replacePlain($string, $data); + return $this->token->replace($tokenized_data, $data); } /**