Closed (duplicate)
Project:
Simplenews Template
Version:
6.x-1.0-beta1
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Jan 2009 at 11:36 UTC
Updated:
16 Jan 2009 at 13:36 UTC
Jump to comment: Most recent file
Comments
Comment #1
tschewe commentedI received the first warning with the same problem and the missing argument is $language.
I went back to SimpleNews to see if I could configure a language but now the SimpleNews configuration page is displaying nothing at all. I tried increasing the memory allowed to PHP in /etc/php.ini which solved this problem in another instance but even going to 64 MB didn't help here.
Damn! Just when I actually installed the newest version of SimpleNews and actually had it doing something useful!
Comment #2
IvanSandpile commentedI got the same error. It disappeared when I set a default value in the PHP code for language:
function _simplenews_template_theme_simplenews_newsletter_body($body, $title, $language='EN') {
Simplenews worked fine, but when I added the template module, the header and footer appeared, but where the email body should have gone, it printed out "Object".
The log reported this error:
recoverable fatal error: Object of class stdClass could not be converted to string in /var/www/drupal/modules/simplenews/simplenews.module on line 1555.
I can still see all of the admin area for simplenews / templates, it just doesn't format the email content.
Comment #3
navs commentedI'm getting the exact same error. When I added the 'EN' bit as suggested, that error line went away, still leaving the second problem. Is this the best newsletter module available for 6.x?
Navs
Comment #4
btsukuda commentedI was having the same issue with no content showing up in (test) emails.
Attached is a diff of changes I made to simplenews_template.module to get it working for me.
First I changed:
to:
This function's variables weren't correct as per simplenews' hook_theme function. I am returning a rendered version of $node->content rather than just $node->content['body']['#value'] since the node's content might be more than just the body. This might be the wrong thing to do, since I can't actually recall checking if there was already a rendered version of the content available in the node object...
Next I changed this:
to:
It looks like this is a hook to allow templating of newsletters based on the id of the newsletter so I didn't want to mess around with that. However, the function "_simplenews_template_mail_alter_simplenews_node" wasn't being called since there was no function of _simplenews_template_mail_alter_{simplenews_test} available. The $processed variable was added since _simplenews_template_mail_alter_simplenews_node() was being called twice for reason, and the second time the script would fail due to an empty $message being passed.
Looking at this now I'm thinking that this could also work without the need for the $processed variable (quick test, and it does):
Last, I changed this:
to:
While I was debugging, I noticed that $message['params']['context']['account']->tids was an empty array while the term id was in $message['params']['context']['newsletter']->tid. I assume there was a good reason for getting the $tid from the account object so I left that in.
So far things seem to be working, but I haven't tested thoroughly, so some take some caution with these changes.
Comment #5
kenorb commentedDuplicate of #346264: Missing argument 3 for _simplenews_template_theme_simplenews_newsletter_body in simplenews_template.module on line 370