I need to change the title of an email (individual content and digest emails) based on the content that is in them.
Specifically, I have nodes that have classifications (for example classified or unclassified) in the form of taxonomy terms.
When a subscription email is sent out, I need to check whether any of the node(s) in the email are classified and add some text to the subject and the body text.
Does subscriptions allow me to do this in any way via hooks?
Or am I going to have to write a patch to add such hooks?
hook_mail_alter() doesn't cut it because it doesn't give access to the kind of data I would need to do this.
It needs to happen at the subscriptions module level.
I will be investigating this myself but it would be great if anyone else with a better knowledge of subscriptions could chime in.
Comments
Comment #1
rooby commentedI found hook_subscriptions_data_alter(), however that doesn't give access to the mail message.
I see that the subject & body text is being set in subscriptions_mail_template_raw() using tokens.
So in theory I can add a classification token that I can use in the templates.
The question then becomes how do I add a token.
Presumably I do this via hook_tokens().
Comment #2
salvisHave a look at hook_tokens_alter(). I think the most promising approach would be to try to add your own tokens with the information that you need, calculated based on the information that Subscriptions provides through its tokens.
This will definitely be harder for digests though.
Comment #3
rooby commentedI have enough info on this now.