Call to undefined function _simplenews_template_message()
| Project: | Simplenews Template |
| Version: | 5.x-1.4 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
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!
| Attachment | Size |
|---|---|
| simplenews_template.module.patch | 550 bytes |

#1
Same 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.
#2
#3
#4
I was getting the same error on submission of the site's contact form with simplenews_template installed. Hanoii's patch worked for me -- thanks!!!
#5
This is a critical bug as it causes white screen of death in certain configurations.
The patch at #2 fixes the problem.
#6
Bumping 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.
#7
is a very important error...,
none of the patches runs for me...
greetings
#8
Hi!
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.
#9
Me 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.
#10
Can anyone discribe how i install this patchfile!
Thank you.
#11
http://drupal.org/patch/apply
#12
Worked great!
#13
Hanoii, thanks for the patch and the link to the manual. Worked perfectly well for me.
#14
Thanks a lot. Hanoli's patch worked for me.
#15
Thanks 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?
#16
Yes Can this please be released in the near future?
#17
Patch #2 Commited.
#18
Automatically closed -- issue fixed for 2 weeks with no activity.
#19
+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.