Closed (fixed)
Project:
Mime Mail
Version:
6.x-1.0-alpha2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Sep 2009 at 21:28 UTC
Updated:
4 Jul 2010 at 00:00 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
guillaumeduveauSame here
Comment #2
gregarios commentedDitto...
Comment #3
brei9000 commentedSame issue.
Comment #4
guillaumeduveauThere's a new related issue I'm marking as a duplicate of that one (#614920: mimemail.tpl.php not loaded from custom theme).
Gregarios and brei9000, is your theme a subtheme of Zen as well ?
Comment #5
gregarios commentedI'm not using Zen or any subtheme. I'm using a custom theme.
Comment #6
yrocq commentedIt may be related to Simplenews : http://drupal.org/node/374222 (Template files do not work when using admin theme). I will check this next week.
Comment #7
gregarios commentedI'm not using simplenews, but Subscriptions Module, and there is still a problem with this.
Comment #8
aschiwi commentedSame issue for me and I'm not using Zen. Am using Simplenews though (but Simplenews templates are working fine from the theme directory)
Comment #9
brei9000 commentedI am using Zen and Simplenews.
Comment #10
jlyon commentedI have the same problem using Zen and Simplenews too.
Comment #11
yrocq commentedMy problem was because I checked the box "Use administration theme for content editing" in Administration theme settings. When I sent a newsletter issue, drupal looked for the custom template in the admin theme directory instead of the global theme one.
Upgrading from simplenews rc6 to stable version solved the problem. I let this issue open because other people have the same problem without using simplenews. However, the problem may be caused by the same kind of bug, so it may be a good thing to post an issue to the page of the projects that send the mail (like Subscriptions).
Comment #12
visios commentedSame problem here here with Zen, Simplenews 6.x-1.0 and MimeMail 6.x-1.0-alpha1.
Comment #13
yrocq commentedComment #14
Anonymous (not verified) commentedThis is my solution.
1.
Rename template file 'theme/mimemail.tpl.php' to 'theme/mimemail_message.tpl.php'.
2.
Change 'mimemail' to 'mimemail_message' in mimemail_theme_theme() function.
theme/mimemail.theme.inc:
- 'template' => 'mimemail',
- 'pattern' => 'mimemail__',
+ 'template' => 'mimemail_message',
+ 'pattern' => 'mimemail_message__',
3.
Remove file include in mimemail_theme() and create init hook.
This is necessary, without this module is not including 'mimemail.theme.inc' file and doesn't call preprocess function.
mimemail.module:
function mimemail_theme() {
- module_load_include('theme.inc', 'mimemail', 'theme/mimemail');
return mimemail_theme_theme();
}
+/**
+ * Implementation of hook_init().
+ */
+function mimemail_init() {
+ module_load_include('theme.inc', 'mimemail', 'theme/mimemail');
+}
===
Hope this helps.
Comment #15
dsms commentedsubscribe
Comment #16
rfayThis patch follows up #14, and ends up working fine for me. This simplifies the path just a bit. The mimemail.tpl.php gets moved right out into the module directory. The theme directory is removed and logic moved into the .module file.
This also avoids problems caused by #591804: Theme registry build bug: External file with template_preprocess is not loaded if tpl.php is copied into theme, which has not yet been committed to core D6. But this problem was *not* caused by that issue. However, simpler paths keep the theming layer saner, so this is IMO a good thing.
Please try this out and report your results back. Set it to RTBC if you think it is.
Comment #17
sgabe commentedI couldn't either override the mimemail.tpl.php from my custom theme with using another administration theme. It seems, you have to place the modified template files in your administration theme (whatever it is), it will be loaded from there.
@rfay: I tried your patch. I was about to do those modifications that you made, to see if that helps, but as I wrote above it didn't work out. Not even with an own hook_theme() in my theme with a given path. I tried manipulate the theme registry, I was able to modify it to see my theme registered with the mimemail_message but it didn't work anyway.
Comment #18
plachI tried the attached variant of #16 and seems to work well with MimeMail 6.x-1.0-alpha1 + Simplenews 6.x-1.0 with the patch attached to #374222-73: Template files do not work when using admin theme applied (admin theme and admin theme for content editing ON).
Before patching Simplenews the attached patch seemed not to work because Simplenews couldn't select the right theme.
Currently the embedded styles are the ones of the admin theme but this can be fixed by using a mail.css stylesheet in the custom theme root or by overriding the
cssvariable via a template preprocessor.Comment #19
sgabe commentedI don't think that the described solution in #14 and #16 is the right one. These changes break more things than fix (according to other issues waiting to be reviewed and committed), but I tried rfay's patch and it didn't work. (By the way, the path is wrong in the patch, you should use the module directory's root to patch creating.)
I tried again with Simplenews 1.x-dev which should fix a referring issue as plach wrote, but no change at all.
I think right now the best solution, if you are using another administration theme than your default theme, is to place mimemail.tpl.php into that theme's folder, until a real fix comes.
Comment #20
rfay@squabe: #18 seems to have rerolled my patch in #16 that had the wrong root. I apologize for that.
Note that it is conceivable that all this might have shifted in drupal-6.16, since #591804: Theme registry build bug: External file with template_preprocess is not loaded if tpl.php is copied into theme was committed. However, I'm still happily using the solution in #16, now with Drupal 6.16. It completely solved my issue.
@squabe: I encourage you to mention what things you think this patch breaks that are fixed and ready to commit, and give some links. Not sure if I'm willing to work on this extensively, since I have a good fix, but I may. We also haven't had Allie chime in on anything here.
Comment #21
sgabe commentedI have tested this workaround on a clean Drupal 6.16 install with Simplenews 1.0 and 1.x-dev with these steps.
E-mail arrived with no change. The module's template file is used every time. If the template file moved into Garland's (the selected administration theme) folder, everything is sunshine and happiness (at least a little bit).
@rafy: Following these steps can you send a customized newsletter?
I think this is not even a bug in MimeMail, but a bug in Drupal itself, and this issue here will be a won't fix. Perhaps your patch works with Zen, but it's not a general solution to the problem. The same goes with Simplenews in this #374222: Template files do not work when using admin theme. Perhaps that solution works with the Admin module, but doesn't solve the issue in general.
Guys, who are just watching, any feedback on this would be appriciated. Please help test this and report back, what did you experience.
Comment #22
sgabe commentedI am deeply sorry. After hours of processing the issue queue, noticed just now that the theme I picked for testing is a Plain PHP theme... My bad. Anyway, I have a good news and a better news. The good, that rfay's solution works after all. The better one, I think there is no need for that. :-)
With Mimemail 6.x-1.0-alpha1 and Simplenews 6.x-1, to override mimemail.tpl.php you just have to use mimemail-message.tpl.php in your theme folder and there is no need for any other modification! Please, try this on a clean install, and confirm it. You have to do nothing, just copy mimemail.tpl.php into your default theme folder and rename it to mimemail-message.tpl.php, it will be loaded just fine.
Comment #23
bkonetzny commentedCan confirm that renaming the file in your template folder to mimemail-message.tpl.php is working.
But I think it's a little bit confusing, normally you don't have to rename template files?
Comment #24
sgabe commentedThe
hook_theme()contains themimemail__pattern, and the module calls thetheme()function with this patterntheme('mimemail_message', $body, $mailkey). So, if you have the mimemail-message.tpl.php in your theme folder, that will be used. If you don't, it falls back to the generic mimemail.tpl.php in the module's folder.Comment #25
sutharsan commentedI agree with Majestixs that using a mimemail-message.tpl.php as override of mimemail.tpl.php is very unusual and it is not documented. This is probably caused by a missing implementation of hook_template(). Attached patches does this.
TODO: documentation in mimemail.tpl.php
EDIT: oops. Ignore this comment and patch. mimemail_theme() is already there.
Comment #26
chill8331 commentedTo#22
Not working for me! If you print out vars from template_preprocess_mimemail_message
Is there something missing? I suppose it shouldn't empty.
And i'm curious how to theme the body content? What template is using for this var? Is that possible theme it as a node?
Struggling on this for days! Looking for help!
Comment #27
sutharsan commentedThe behaviour has nothing to do with the declaration of the pattern ('mimemail__') as stated in #24. It is in fact caused by the difference in name of the theme function ('mimemail-message') versus the name of the template ('mimemail'). Without going to deep into the plumbing, template override only works the way we know it if the theme function has the same name as the template file. To correct this we have two options with its own drawbacks:
* Change function name (to 'mimemail')
- Need to change preprocess function name. This will break existing preprocess overrides
- Will break existing template overrides
+ only changes in code
* Change template file name (to 'mimemail-message')
- needs CVS file changes
The attached patch does the latter.
TODO: documentation in mimemail-message.tpl.php
Comment #28
sgabe commented@Sutharsan: Hmm...you are probably right. With the
patternremoved still the same, it seemed a reasonable explanation. IMHO the best way is to rename the template file to mimemail-message.tpl.php. However I chose this way in #743150: Mime Mail 6.x-1.0-beta1?. I would leave thepatternin order to support features like #319384: Add $mailkey to body tag as CSS class.Comment #29
sutharsan commentedI have no objections against using the pattern. But I removed it while there was no use of it in the current code. Revised patch does not remove the 'pattern' from the theme definition. I leave further modification of the theme('mimemail-message') to issue #319384: Add $mailkey to body tag as CSS class
Comment #30
planctus commentedIs there any chance to have the patch rerolled for the alpha2 version?
I've got into this issue trying to override the mimemail template and i had to switch to the dev version since the patch wouldn't have worked with the alpha2.
But now i see the dev is older and drupal is always asking me to update this module beacuse there's a security update in it...
Thanks,
Da.
Comment #31
Mac Clemmens commentedI am having a problem where I have created mimemail-message.tpl.php in the theme folder, but now my theme's mail.css file is not getting processed and added into the theme. If I just hack mimemail.tpl.php in the module directory, it continues to read the mail.css and puts the styles inline like it's supposed to, but obviously I don't want to change the .tpl.php file in the module. Is anyone else having this problem? I'm going to try a fresh install with the latest versions of everything, but I believe it is CRUCIAL to test that the mail.css file in the theme directory will get embedded correctly when using mimemail-message.tpl.php to override your template.
Comment #32
planctus commentedI used this function to change the path where it looks for the css to add.
Find it in the mimeail.module and override it in your theme's template.php file.
function template_preprocess_mimemail_message(&$variables)See you,
Da.
Comment #33
jerdavisCommitted to HEAD
Comment #35
jm.federico commentedChanging status.
Comment #37
roball commented"theme/mimemail.tpl.php" is tried to be included (but missing), also in 6.x-1.0-alpha3. This causes the following PHP error:
Comment #38
roball commentedComment #39
rfayThe name of the template is now mimemail-message.tpl.php, and it's there in alpha3, in the theme folder.
I deployed simpenews+mimemail just this week successfully (and with moving mimemail-message.tpl.php to the theme's folder).
I'm suspecting that you have a corrupted install? I'd say, delete the existing mimemail and get the current and install it. Also: Make sure you rebuild the theme registry (or clear all caches) as if you just copied in the new module, your theme registry could be out of date. You can rebuild the theme registry by going to the Performance page at admin/settings/performance and clicking the "clear all caches" button.
Comment #40
roball commentedOh yes, I had to clear all caches and got rid of the error. Thanks and sorry for the false-alarm.