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.

CommentFileSizeAuthor
#9 simtem.patch1.05 KBmuschpusch
#4 sn.patch1.65 KBgdoteof
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

artatac’s picture

Priority: Normal » Critical

Also affected by this please advise thanks

gdoteof’s picture

So 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

artatac’s picture

I 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

ul.links.inline {
display:none;
}

.views-admin-links {
display:none;
}

.taxonomy {
display:none;
}
.field-field-image img {
border:0 solid green;
float:right;
margin:4px 0 0 10px;
}

.field-field-image-cache img {
border:0 solid red;
float:right;
margin:4px 0 0 10px;
}
gdoteof’s picture

Status: Active » Needs review
FileSize
1.65 KB

I 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.

zilverdistel’s picture

I 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)

dooug’s picture

Title: no simplenews_template.tpl.php included with module » theme_simplenews_template_mail() function not being called.

I 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:

/**
 * Theme function for the actual content.
 */
function theme_simplenews_template_content($newsletter_name, $issue_title, $header, $issue_body, $footer) {
/**
 * Themeable function for the HTML e-mail content.
 * Based on http://www.mailchimp.com/resources/templates/.
 */
function theme_simplenews_template_mail($newsletter_name, $issue_title, $issue_body, $style, $bgcolor) {

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..

mbarcelo’s picture

Also affected by this.

codevoice’s picture

Subscribing, neither #3 nor #5 worked for me.

muschpusch’s picture

Version: 6.x-1.0-beta3 » 6.x-1.x-dev
Assigned: Unassigned » muschpusch
FileSize
1.05 KB

The 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!

TimG1’s picture

Subscribing...

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

gdoteof’s picture

Priority: Critical » Major
Status: Needs review » Active

Tim, 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

MustangGB’s picture

Assigned: muschpusch » Unassigned
Status: Active » Fixed

It's also fixed in latest dev

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

igorik’s picture

Status: Closed (fixed) » Active

last commit for 6,x dev is still from July 11, 2010 - 08:07
so this is not fixed

ronalddevos’s picture

Also affected by this

muschpusch’s picture

Status: Active » Reviewed & tested by the community

ok switched the status... No idea why it isn't commited... Just use the patch in the meanwhile...

remco75’s picture

Any progress on this: is there gonna be an new version soon? Would be great not having to patch