I have a client who would like to include ads in summary and notification emails. I’ve “crafted” a plugin that allows adding some text to the digest email (which I think needs some updating to catch up with changes made to that template).
I don’t like that I have to override the entire template to customize those emails.
Would it be possible to include a way to add to those emails without overriding the template?
The plugin works by having taking a topic ID in a custom field and including raw of the last post in the topic as the text added to the email (just before or after the header). Though I think it’s a pretty clever hack, that seems a bit too fiddly a solution to suggest adding to core. Perhaps there’s a way to have the Ad plugin be able to apply house ads to the digest and summary emails?
Managing a fragile plugin
Maybe I should write a spec that compares the digest email with the plugin off with the digest email with the plugin on but not configured to add anything to the email? Then I’d catch changes to the core template?
D’après ce que je comprends, digest_custom_html et digest_custom_text implémentent déjà des hooks pour digest.html.erb et digest.text.erb. Donc, une implémentation de base de cette demande impliquerait d’ajouter plus de ces hooks ?
Une implémentation plus avancée pourrait fournir des sous-modèles, qui pourraient être utilisés pour fournir aux auteurs de plugins du code de style et de formatage maintenu par Discourse.
Est-ce que je comprends correctement que votre implémentation serait possible avec un digest_custom_html("before_preheader") ajouté à digest.html.erb ?
Salut @thoka, as-tu réussi à implémenter quoi que ce soit via ces hooks ? Nous cherchons actuellement à injecter des segments sponsorisés simples via ces hooks.