New Drupal 6 release of Simplenews Template
jeffsensat - April 7, 2008 - 12:11
| Project: | Simplenews Template |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Description
I was just wondering if migration to and integration with Simplenews on Drupal 6 is on the roadmap.

#1
It's definitely on the road map. But I will probably not have time for it before summer (if not a customer of us request it before that).
#2
Just want to check the progress of this issue. Any planned updates?
Thanks,
#3
#4
subscribing!
#5
subscribing too!
#6
Here's a first rough stab at a port for D6 from the 5.x-1.2 version.
The main thing is that the per newsletter CSS is not working after changes to Simplenews. You can include a single mail.css file from your theme folder if you add some code to your template.php.
/*** Override mimemail message theme so that mail.css is
* called from this theme folder rather than the module folder.
*/
function phptemplate_simplenews_template_mimemail_message($body) {
return theme_mimemail_message($body);
}
The emogrify feature is not working either, though that is possibly fixable. I couldn't see a way to get the per newsletter CSS working though.
#7
subscribing
#8
subscribing
#9
subscribing
#10
Subscribing
#11
Here's an updated work based on #6, patched against 5.x-1.2.
Not working yet:
* Menu / preview of newsletters
* Actually adding the template stuff to a newsletter, needs to work with hook_mail_alter I think
Changed from #6
* Re-worked the form_alter to work, added a submit function and moved around some code to make it smaller and more readable.
Patch adds a couple of files that were in #6 but not in 5.x-1.2, and also moves translations to a new folder.
#12
And here's a .zip for those who likes that better...
#13
Updated patch that actually works. You have to use the latest Simplenews -dev to work with Mimemail.
E-mails sent out has the header and footer you set. If you have a mail.css in your theme folder and a small template function in your template.php (see README.txt) those styles will get included.
Not tried the emogrifier stuff.
Feels like we should get this in to a 6.x-dev soon so more people could try it out...
Not sure why muhleder deleted the help texts in his version, I'll add them back later.
Docs needs updating to.
#14
Hiya,
I'm not sure why I deleted them either..
I used the deadwood module to do the initial work so that might have skipped them? There were also a load of comments in the code which I thought had been inserted by deadwood, so I stripped them out just to read the actual code a bit easier.
#15
Patch in #13 does not applied clean against 5.x-1.2:
patching file simplenews_template/CHANGELOG.txtThe next patch would create the file simplenews_template/README.txt,
which already exists! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file simplenews_template/README.txt.rej
patching file simplenews_template/simplenews_template.info
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file simplenews_template/simplenews_template.info.rej
patching file simplenews_template/simplenews_template.install
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file simplenews_template/simplenews_template.install.rej
patching file simplenews_template/simplenews_template.module
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 83.
Hunk #3 FAILED at 103.
Hunk #4 FAILED at 142.
Hunk #5 FAILED at 244.
Hunk #6 FAILED at 309.
Hunk #7 FAILED at 432.
7 out of 7 hunks FAILED -- saving rejects to file simplenews_template/simplenews_template.module.rej
The next patch would create the file simplenews_template/translations/fr.po,
which already exists! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file simplenews_template/translations/fr.po.rej
The next patch would create the file simplenews_template/translations/no.po,
which already exists! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file simplenews_template/translations/no.po.rej
The next patch would create the file simplenews_template/translations/simplenews_template.pot,
which already exists! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file simplenews_template/translations/simplenews_template.pot.rej
Looking into patch, seems it createn against 5.x-1.1:
diff -urp -N simplenews_template_5/simplenews_template.info simplenews_template/simplenews_template.info--- simplenews_template_5/simplenews_template.info 2007-04-10 00:00:24.000000000 +0200
+++ simplenews_template/simplenews_template.info 2008-11-19 11:58:55.000000000 +0100
@@ -1,9 +1,14 @@
-; $Id: simplenews_template.info,v 1.1 2007/03/22 20:27:54 tbarregren Exp $
-name = "Simplenews Template"
-description = "Extends Simplenews by providing a themable template with configurable header, footer and style."
-version = "$Name: DRUPAL-5--1-1 $"
-dependencies = simplenews mimemail
-; Information added by drupal.org packaging script on 2007-04-09
-version = "5.x-1.1"
(last line?!)
Patch applied more cleanly to 5.x-1.1, but not works :(
#16
Adding header and footer work only for 'simplenews' node type because of hardcoded 'if' here:
function simplenews_template_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {if ($node->type == 'simplenews') {
$function = "_simplenews_template_node_$op";
if (function_exists($function)) {
return $function($node, $a3, $a4);
}
}
}
Adding header &footer in _view op seems incorrect because header & footer visible in standart node view. So cool simplenews feature transforming any node type to news become unusable :( Sorry, i have not enought skills for fix that.
One more thing: enabling simplenews_template leading to white screen of death on many administrative pages...
#17
subscribing
#18
subscribing
#19
I have a working port up and running but am still ironing out a few quirks, which I hope to have fixed this week.
#20
A beta release for Drupal 6 is out! Except for the Emogrifier integration, which I am looking at next, it should be a fully working port. Feel free to correct me on that if you find that I'm wrong.
#21
Unfortunately it doesn't work fully:
#346264: Missing argument 3 for _simplenews_template_theme_simplenews_newsletter_body in simplenews_template.module on line 370
#22
I've rolled a new beta with that applies the patch in #28 of #346264: Missing argument 3 for _simplenews_template_theme_simplenews_newsletter_body in simplenews_template.module on line 370.
Unfortunately, I haven't had time to until now to take a look at the port from D5 to D6. Doing that, I've noticed that there are several things that still requires attention from tobiassjosten or me. In addition, I've fixed some problems and added features to the new 5.x-1.3 release. These must also be incorporated. Taken together I must say that this release, labeled as a beta, actually is an alpha release. But I am afraid that changing the tag from beta to alpha would be to confusing, so I decided to stick with the beta label. But please, bear in mind that this actually is an alpha release.
#23
I've added several new features to Simplenews Template 5.x-1.4-BETA2 as well as fixed some issues. With these done, it is my intention to now focus on the 6.x port together with tobiassjosten.
#24
Hello,
With beta2, I couldn't see any headers or footers. I figured this out and have created a patch, I think it only happens when you have more than one newsletter series. Hope it helps someone.
kelvin,
Orange Bus
#25
Subscribing.
#26
Subscribing.
#27
subscribing
#28
i tried the latest version of this module along with these related modules:
Simplenews 6.x-1.0-rc5
Simplenews on register 6.x-1.0
Simplenews Statistics 6.x-1.1
Mime Mail 6.x-1.x-dev
And now when I send a test newsletter, I get a white screen - no errors. I disable the Template module and the newsletters go out OK. And the log doesn't show any errors.
I'm not sure where to go to help fix this but I thought I should report my findings.
#29
If you can take a look at the php error log you should be able to see which particular line of code is causing the crash. You can also set php to print errors to the screen which should give you the same information, though you wouldn't want to have that enabled on a production server.
#30
Subscribing
#31
This patch should be implemented as well:
#345246: Two opening body tags
http://drupal.org/cvs?commit=168052
#32
I apologize fo my lack of update on this issue. What seems to be the current "problem" is that Simplenews and Mime mail for D6 apparently provides quite a bit of what Simplenews template used to handle - namely templates and CSS immersion. This is great stuff of course but it begs the question of what role Simplenews template should fulfill in the future. Me and Thomas have been discussing this and come to the conclusion that since the body and footer additions are still not provided by Simplenews, that should still go in this module.
Because I never seem to get enough free time to make this happen, and I don't want to have it look like I am actually working on this so others might hold off, I will go ahead and unassign me from the issue.
#33
Subscribing
#34
subscribing
#35
Woohoo! Works very well - even with FCKEditor using images - downloaded the beta2 and applied patch above. Thanks you guys.
#36
Subscribing
#37
subscribing
#38
For those who want simpler way to make a header and footer without any module (only yours), try this:
<?php
/**
* Implementation of hook_mail_alter().
*
*/
function foo_mail_alter(&$message) {
$msg_id = $message['id']; // get Message ID
/* detect mail body format */
if (is_array($message['body'])) {
$body = &$message['body'][0];
} else {
$body = &$message['body'];
}
/* set header and footer */
$header = theme('foo_mail_header');
$footer = theme('foo_mail_signature');
/* check Message ID and prepare body to sent */
switch ($msg_id) {
case 'simplenews_node':
case 'simplenews_test':
$body = $header . $body . $footer;
break;
default: // other mails
$body = $header . $body . $footer;
watchdog ('mail', "Mail sent with ID: " . $msg_id); // log for testing purposes
}
}
/**
* Implementation of hook_theme().
*/
function foo_theme() {
return array(
'foo_mail_header' => array(
'arguments' => array(),
'file' => 'foo.theme.inc',
),
'foo_mail_signature' => array(
'arguments' => array(),
'file' => 'foo.theme.inc',
),
);
}
?>
And in foo.theme.inc file you should define functions: theme_foo_mail_header() and theme_foo_mail_signature() like:
<?php
/**
* theme function for mail header
*/
function theme_foo_mail_header($user = NULL) {
global $user;
return !empty($user->picture) ? "<center><img src='$user->picture'></center>\n\n" : '';
}
/**
* theme function for mail signature
*/
function theme_foo_mail_signature($user = NULL) {
global $user;
return !empty($user->signature) ? "\n\n--\n$user->signature" : '';
}
?>
Don't forget to clear the cache, to rescan theme files.
#39
Or try this alternative:
http://drupal.org/project/mail_header
Because this module should be simple, so I don't know why there is so many bugs in simple functionality which should provides header and footer.
After long time of using it, patching and patching, I've decided to remove this module and put above functions in my module - work perfectly.
In my opinion at least there should be something committed for core 6.x to make some order (last commit for 6.x is from January).
May people don't know about that, because it's not even listed. And there are too many patches to many version.
Or please give me cvs permission, I'll commit latest 6.x version, and then this thread should be closed after 1 year.
#40
@kenorb: Thanks for that. I'd really like to see an official 6.x release of this module, but if that doesn't happen any time soon it looks like I'll be able to get what I need from the code you posted.
#41
is there anyway to use panels to format the newsletter and then email the newsletter using simplenews?
Chris
#42
That sounds pretty adventurous! :O I don't know, but I guess it would be possible. Doesn't sound easy tho! :/
#43
Is there a tutorial on how to create a newsletter using simplenews? Is there a use case?
i haven't found one and I don't have a clue on where to start.
#44
subscribing
#45
subscribing
#46
subscribing
#47
Subscribing
#48
For what it's worth, I've just updated a Drupal 5 site to Drupal 6, with simplenews and simplenews_template modules. This port of template isn't really working tbh and you can get headers and footers using the template files now provided inthe simplenews module. They have to be stored as files in your theme folder rather than being configurable from the admin interface, but personally this works better for me.
Given that the functionality of Simplenews Template is now provided by Simplenews itself, I think it's very unlikely that anyone's going to do the work to get this module working. Should maybe mark this module as abandoned for D6?
#49
subscribing
#50
Well not really.... I was using Simplenews template not for the header and footer but fotr the white background it can provide.
I had on D5 ( and still have on D6) a bug where a colored background would automatically be added to the emails sent making it difficult for my users to read, especially the links.
So I would be happy if this module was still maintained for D6 :)
#51
Well... you could open a div or table (with a white background) in the header and close it in the footer with the templates in simplenews. Prob better off fixing the bug if you can though.
The thing is that anyone who would be able to update the module, would prob find the templates a better option, so imo unlikely that it's going to happen.
#52
I am not very good at dealing with templates myself... but I done the table trick and it has work... thanks for the tip :)
#53
But can you override the style.css from your theme with simplenews theming?
I want to find a way to replace my massive style.css file from being attached to all my mimemail mails...
#54
You can, but from memory it's mimemail that is responsible for putting the css file into the newsletter. I've got mimemail_message.tpl.php in my theme folder (can be within sub directory), which contains the code below for me.
You can see that it gives you full control over the newsletter output. The text version of the newsletter is auto-generated from the resulting html (again from memory, but pretty sure that's correct).
The $body variable gets generated by simplenews, and should include the header and footer templates.
<?php
// $Id: mimemail.tpl.php,v 1.1.2.2 2009/04/14 23:09:01 jerdavis Exp $
/**
* @file mimemail.tpl.php
*/
?>
<html>
<head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<style type='text/css'>
td#saw-newsletter-footer a:visited,
td#saw-newsletter-footer a:link {
text-decoration:none;
color:#007BBF;
}
table h1,
table h2,
table h3,
table h4,
table h5,
table h6 {
color:#007BBF;
}
p {
margin-top:10px;
margin-bottom:10px;
}
</style>
</meta>
</head>
<body style='padding:0;margin:0;'>
<table style='font-family:Helvetica; font-size:12px;' align='center' bgcolor='#dddddd' width='100%' height='100%' cellpadding='0' cellspacing='0'>
<tr>
<td valign='top' align='center'>
<?php print $body ?>
</td>
</tr>
</table>
</body>
</html>
#55
muhleder, thanks so much for that really appreciate it.
#56
Sub - can't test yet, but will be working on a client's site in a few weeks which will require this module. I'll help as much as I can!
#57
> For what it's worth, I've just updated a Drupal 5 site to Drupal 6, with simplenews and simplenews_template modules. This port of template isn't really working tbh and you can get headers and footers using the template files now provided inthe simplenews module. They have to be stored as files in your theme folder rather than being configurable from the admin interface, but personally this works better for me.
Downside is you can't let end-users configure their newsletters -- eg site editor wants to change the header message on their organization's newsletter.
I think there's still a case for this module.
#58
"Downside is you can't let end-users configure their newsletters -- eg site editor wants to change the header message on their organization's newsletter.
I think there's still a case for this module."
That's very true, but you could provide that sort of functionality using a little bit of custom code and the simplenews template files. Would think you could use hook_form_alter to add a signature field to each node edit page of type simplenews, then save that as a variable keyed to the term id. (So you get a unique signature for each newsletter). Then add that variable to the simplenews template file.
Would be better as a self contained module, but imo simplenews has changed so much you might be better off writing something like that from scratch rather than continuing the port of the D5 simplenews template module. Seems like people have been finding quite a few problems with it.
#59
Right, so let's make the D6 version of this module match up to Simplenews D6. What's the point in registering a new module name when this one is a fair description?
Looking at the documentation page for this module, the D5 version did 3 things:
- provide an admin UI for per-newsletter header and footer
- provide a phptemplate template file
- emogrifier
We keep 1, ditch 2 because simplenews does it now, and I've no idea about 3.
Are the maintainers of this module still around?
#60
@joachim:
Maintainer here. :-) I think that is he way to go: keep 1 and ditch 2. Regarding 3, the MimeMail Compress module, bundled with MimeMail, is a ripoff of Emogrifier, so it could probably also be ditched.
#61
@TBarregren: I need this module for a project fairly soon, so I'm very interested in getting a proper release for D6. How can I help with this?
#62
There are patches for the HTML Mail module too for Emogrifer : http://drupal.org/node/489960#comment-1913454
#63
As joachim, I am currently using the module and also might be able to help, what's the status of the module, still maintained? abandoned? Is there room for contributing in a more active way than submitting patches into the queue? Maybe consider co-maintainers?
#64
I tested the patch from #24 and it seems to be working.
#65
What is still missing before we can release a 6.x version?
#66
Subscribing
#67
Hi, This is almost end of 2009!
Can the alpha released be updated and released with latest updated, if any??
Thanks a lot for your attention.
==============================================
Official release from CVS tag: DRUPAL-6--1-0-BETA2
First released: January 31, 2009 - 20:35
Download: simplenews_template-6.x-1.0-beta2.tar.gz
Size: 12.88 KB
md5_file hash: 0881a4ef6f1992f0b305eef94b04520c
Last updated: January 31, 2009 - 20:40
==============================================
#68
Ok, all co-maintainers, what's the roadmap? This module really need a release. I'll try to work on critical bugs from here.
Please, try to finish bugs assigned to you.
I'll get these:
#609442: Site CSS in HTML mail header
#373915: some broken html code after the mail
#605212: Tokenize the header and footer
#391874: FYI: Some remarks about the html
Will update the status here, hope we can have at least a beta3 launched and minimally supported.
#69
Updating title so that I can identify the issue in my tracker.
#70
Up to go, there are only a few major bugs left.
#71
Thanks a lot Franz :)
#72
All bugs currently fixed!
Beta3 out of the oven on the next minutes
#73
Great! Thanks for your work on this. I'll be testing over the next few weeks, as I'm going to be using this on two separate sites.