The .erb template can’t be overridden by a plugin.
Car Talk has its own digest emails. How we did that in a plugin was to treat it as a new email entirely. You could disable Discourse’s default digest emails and then use your own. It’s more complicated than making a new template though…
- Create a new scheduled job in the plugin that is the same as enqueue_digest_emails.rb but will queue your new email.
Jobs.enqueue(:my_custom_digest_email, user_id: user_id) - Create your new mailer in
app/mailers. Copy the digest method from the user_notifications.rb mailer into your mailer. - Put your new template for the email in
app/views/mailers/my_custom_digest_email.
Not ideal, but gives you a lot of freedom to customize the data and logic.