Hello!
I'm not sure if I miss something here, but how do I put additional Variables to mimemail.tpl.php without altering mimemail_theme_theme()?
Besides the $body variable, I also need the $subject to put it in the email too.
I am aware that I could use the templatehook_preprocess_mimemail_message(&$variables) to add "own" variables,
but thats useless until I have no possibility to access $subject.
The only way I see, is that you alter mimemail_theme_theme(), to let it pass $subject as an extra argument to the template and then call theme('mimemail_message', $body, $mailkey, $subject); in mimemail.module.
I would provide a patch if needed!
Thanks in advance!!
Comments
Comment #1
sgabe commentedI think you are right,
mimemail_theme_theme()should pass the$subjectas argument to the template. I am willing to test and review your patch if you attach one.Comment #2
sgabe commentedOr maybe you can review mine.
Comment #3
dsms commentedOh thanks, I really appreciate your fast work! I testet it against -alpha1 and it works well!
Please drop a line, when you'll have included the patch in -dev.
Comment #4
Hervé Saladin commentedSeems to work fine for me too.
Thanks :)
Comment #5
Mac Clemmens commentedHere's the same patch that allows the $recipient variable to be passed to the theme function as well. This is very helpful when theming in specific things for the $recipient. (Such as "Premium member" on the header of the e-mail, or "Edit your profile").
When I first started theming, I didn't get that $vars['user'] variable in theme_preprocess_mimemail_message($vars, $hook) was the user who triggered the e-mail to send (in some cases an anonymous user) not the actual recipient. So if user 1 ran cron.php which caused an e-mail to be sent to user 2, $vars['user']['uid'] would be 1. I made the mistake of assuming that $vars['user'] was the recipient, but that is not the case. (But appears to be the case when testing.)
Adding $recipient to the theme_preprocess_mimemail_message function solves that.
My 2 cents.
I don't have access to CVS at the moment, (sorry) but here is the patch:
Comment #6
Mac Clemmens commentedComment #7
sgabe commented@Mac Clemmens: Please open a new issue for your request, $recipient won't get in with this issue.
Attaching a new patch against current HEAD.
Comment #8
sgabe commentedCommitted to HEAD.