We have a module that sends an email message as part of cron, using Mimemail. When cron runs, we get this error:
Call to undefined function _simplenews_template_message() in ../sites/all/modules/simplenews_template/simplenews_template.module on line 183
The call sequence is this:
our code -> mimemail() -> mimemail_prepare() -> theme_mimemail_message() -> phptemplate_mimemail_message()
... which tries to call _simplenews_template_message(). Since phptemplate_mimemail_message() was called from outside Simplenews Template, _simplenews_template_message() hasn't been loaded yet, and this triggers the error.
I did a quick fix, by testing for the existence of _simplenews_template_message() before calling it. I've attached this as a patch. This lets our email message through, and I presume this lets simplenews_template do what it needs to do.
However, I'm not sure this this is the best way to fix this ... any suggestions?
Let me know how I can help ... and nice module, BTW!
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | simplenews_template.module.patch | 779 bytes | hanoii |
| simplenews_template.module.patch | 550 bytes | jshuster@drupal.org |
Comments
Comment #1
hanoiiSame problem here on a similar scenario, although I think the first patch needs work because it's bypassing what simplenews_template does. The problem is that on cron run, an inclusion file is not properly included. I have attach a patch that include the missing file before calling functions on that file.
I do have a question. I have seen this in many modules and I am wondering why this is a common practice. I understand the need of cleaning up the code a little bit by putting functions inside include files, however, I feel it's better if the include file is included at the beginning of the module's file than on each function that requires a function from that file. I think this approach is less error-prone in terms of forgetting to include a file when it's actually needed.
Anyway, patch attached.
Comment #2
hanoiiComment #3
hanoiiComment #4
ob3ron commentedI was getting the same error on submission of the site's contact form with simplenews_template installed. Hanoii's patch worked for me -- thanks!!!
Comment #5
z.stolar commentedThis is a critical bug as it causes white screen of death in certain configurations.
The patch at #2 fixes the problem.
Comment #6
hanoiiBumping up this issue. I just noticed that there's more scenarios, not only cron run, when the site throws up this fatal error. My patch at #1 fixed that as well.
Comment #7
quinti commentedis a very important error...,
none of the patches runs for me...
greetings
Comment #8
billyjp commentedHi!
Have the same error "Fatal error: Call to undefined function _simplenews_template_message() in /var/www/pomberger/htdocs/pomberger/sites/all/modules/simplenews_template/simplenews_template.module on line 183"
How can i use the patch? Copy it over the simplenews_template.module?
Thanks for your help.
Comment #9
nofue commentedMe too -- sending a message through the contact form, users get the wsod. Would be great if there were a patched (dev) version for dl, as patching modules isn't exactly my best skill :) TIA.
Comment #10
billyjp commentedCan anyone discribe how i install this patchfile!
Thank you.
Comment #11
hanoiihttp://drupal.org/patch/apply
Comment #12
AppleBag commentedWorked great!
Comment #13
nofue commentedHanoii, thanks for the patch and the link to the manual. Worked perfectly well for me.
Comment #14
viktor.mastoridis commentedThanks a lot. Hanoli's patch worked for me.
Comment #15
ngaur commentedThanks for the patch hanoi.
I'm a bit concerned at how long this has gone unpatched in the module source. Can we please have a fixed release?
Comment #16
RXM307 commentedYes Can this please be released in the near future?
Comment #17
hanoiiPatch #2 Commited.
Comment #19
philippejadin commented+1 for a release with this fix.
It's critical as it disalow people to subscribe and has a lot of other nasty effects. For example on our site, when people add content, a mail is sent. Without the patch, anonymous users cannot contribute to the site anymore.