Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am trying to send some prettier newsletters.
I finally realized that the newsletters are being sent out using the mimemail.tpl.php file in the mimemail/themes directory.
I do not have a simplenews_template.php anywhere in the simplenews or simplenews_template folders, as per the documetnation.
Not sure what to do.
Comment | File | Size | Author |
---|---|---|---|
#9 | simtem.patch | 1.05 KB | muschpusch |
#4 | sn.patch | 1.65 KB | gdoteof |
Comments
Comment #1
artatac CreditAttribution: artatac commentedAlso affected by this please advise thanks
Comment #2
gdoteof CreditAttribution: gdoteof commentedSo after screwing around with the theme functions I am 99% sure simplenews_template is actually just doing nothing to the emails. No amount of messing with the theme functions (which seem to have replaced the tpl.php files) has any effect on the emails being sent out by simple news
Comment #3
artatac CreditAttribution: artatac commentedI have had some success > install simplenews_template then go to admin/content/simplenews/types/edit/xx > go to the Style section > css at the bottom and put in stuff like below
regards
Joe
Comment #4
gdoteof CreditAttribution: gdoteof commentedI think I fixed this for my own purposes at least.
A couple things were happening. $tid was not being found correctly sometimes, so sometimes we weren't aware of which newsletter we were on. I am not sure if I am correctly extracting the proper term, it seems looping through all of them may be a waste.
The other thing was the simplenews_template_mail theme function was not getting called because it was inside of a if (is_null($message['body']), so it would only be templated when it was empty??
Also, the documentation just needs to be updated. Themes are now done in functions instead of tpl files apparently.
Your theme can implement theme_simplenews_template_mail and theme_simplenews_template_content
I just took the ones out of the simplenews_template module and slightly altered.
Comment #5
zilverdistel CreditAttribution: zilverdistel commentedI did not apply the patch entirely, only the following part:
- if (is_null($message['body'])) {
+ if (!is_null($message['body'])) {
That solved the problem for me (theme functions not being overridden)
Comment #6
dooug CreditAttribution: dooug commentedI was also trying to write my own override for the theme_simplenews_template_mail function and discovered it was not being called.
I found the descriptions of the themeable functions to be very deceiving:
At first I though the *_content function would theme the node on the site and the *_mail function would theme the node when emailed. However, now I am under the understanding that the _content function themes the content of the node and the the _mail function puts HTML wrappers around that output when it is mailed.
Also, I was confused by the documentation instructing to use the simplenews_template.tpl.php while there is no such file. Is that file supposed to be available to theme the simplenews nodes on the site?
For clarity, I have changed this title to be more appropriate for the patch that needs review above, and the issue of the missing simplenews_template.tpl.php file should be discussed at #684836: D6.x version has no simplenews_template.tpl.php file..
Comment #7
mbarcelo CreditAttribution: mbarcelo commentedAlso affected by this.
Comment #8
codevoice CreditAttribution: codevoice commentedSubscribing, neither #3 nor #5 worked for me.
Comment #9
muschpusch CreditAttribution: muschpusch commentedThe new dev release fixes this part of the patch:
- if (is_null($message['body'])) {
+ if (!is_null($message['body'])) {
The other parts are still needed when working with simplenews 6.x-2.x-dev. I attached a new patch. Please review & test!
Comment #10
TimG1 CreditAttribution: TimG1 commentedSubscribing...
I'd love to test, but I have no idea where/how to start/test.
Can anyone provide an example on how to use this function?
function theme_simplenews_template_content($newsletter_name, $issue_title, $header, $issue_body, $footer) {
Where does this function go? In template.php? Do I create a new file called simplenews_template.php and put it in there? Once I have it in the correct file, how do I use it?
Thanks for reading,
-Tim
Comment #11
gdoteof CreditAttribution: gdoteof commentedTim, you make a function in your template.php called
THE_NAME_OF_A_THEME_simplenews_template_content(...)
basically you are replaceing the 'theme' in 'theme_simplenews..' with the name of your actual theme.
moving to major, because apparently it's not critical
Comment #12
MustangGB CreditAttribution: MustangGB commentedIt's also fixed in latest dev
Comment #14
igorik CreditAttribution: igorik commentedlast commit for 6,x dev is still from July 11, 2010 - 08:07
so this is not fixed
Comment #15
ronalddevos CreditAttribution: ronalddevos commentedAlso affected by this
Comment #16
muschpusch CreditAttribution: muschpusch commentedok switched the status... No idea why it isn't commited... Just use the patch in the meanwhile...
Comment #17
remco75 CreditAttribution: remco75 commentedAny progress on this: is there gonna be an new version soon? Would be great not having to patch