Closed (fixed)
Project:
Simplenews
Version:
7.x-1.0-rc1
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
13 May 2013 at 09:42 UTC
Updated:
12 Jun 2013 at 07:50 UTC
Hey there,
i am actualy having a big problem with one of my simplenews templates. I want to print a node reference field in the newsletter with this code:
<?
php print render($build['field_nref_pressestelle'][0]['field_nref_pressesprecher']);
?>
Anything works just fine when i send it as a testmail. But when I try to send it via cron to all subscribers, the reference wont appear ... :-/
Any idea about that?
I attached the full template and a screenshot to my content view configuration to the thread.
| Comment | File | Size | Author |
|---|---|---|---|
| nref.PNG | 51.63 KB | sgurlt | |
| simplenews-newsletter-body--200--email_html.txt | 4.19 KB | sgurlt |
Comments
Comment #1
jos_s commentedI am experiencing the same problem. This is really a show stopper. It makes the module useless for me.
Comment #2
jos_s commentedIn reply to myself. I found a cause and solution for my problem, though I really think it is a bug in the module.
I have a custom theme for my HTML emails for simplenews. In that theme there I have a custom template: htmlmail--simplenews.tpl.php
There is also such a template in the website theme, which is however different.
It appears that when sending a test for a newsletter, the template file in custom theme is used (as it should be), but when sending the newsletter with the cron, the template file in the website theme was used (which is wrong!).
Somehow, when sending the newsletter with cron, the system does not use the configured theme for sending e-mails, but the website theme.
Can someone tell me where this happens in the code?
Comment #3
miro_dietikerThis is really complicated. We have a lot tasks about this topic.
One of the key issues is: #374222: Template files do not work when using admin theme
Comment #4
miro_dietikerAlso please check the README. The problem is covered there.
Comment #5
berdirYes, this is extensively documented in the README.txt.
Note that you are using a generic mail template provided by htmlmail.module, so the documented workaround for this won't work because it doesn't integrate with that. I suggest you use our own template simplenews-body.tpl.php, which is a replacement for node.tpl.php in which you have access to the $content render array and it's run through the token replacement). There's also a simplenews-footer.tpl.php, if you want to change that.
Comment #6
jos_s commentedThank you miro_dietiker and Berdir for pointing me to the information. I had missed the line in the README that was about the problem, and I had not yet found issue #374222 yet. This will surely help me solve my problem.
It really is complicated...