Download & Extend

Improve documentation on the order of precedence of theme suggestions.

Project:HTML Mail
Version:7.x-2.x-dev
Component:Documentation
Category:task
Priority:normal
Assigned:pillarsdotnet
Status:needs work

Issue Summary

I have a global htmlmail.tpl.php template in my e-mail theme which works fine for all my emails (i.e. webform mails). However, this template isn't used for user e-mails (like password recovery), unless i specify a more specific template.

For example: htmlmail--user--password_reset.tpl.php works for password recovery e-mails, but when I remove it, the global htmlmail.tpl.php template isn't used for this e-mail.

Comments

#1

Status:active» postponed (maintainer needs more info)

You'll need to remove the extra template from both the htmlmail module directory and your theme directory, if you're using an email theme.

Then you'll need to visit admin/config/development/performance and clear your cache.

If this doesn't work, then let me know, because something is broken and I need to fix it.

#2

Component:Code» Documentation
Category:bug report» support request
Assigned to:Anonymous» pillarsdotnet

I should document this better.

#3

Thanks for your quick response, it works when i remove htmlmail--user--password_reset.tpl.php in the htmlmail directory.

However, isn't it strange that the template for password recovery in the htmlmail directory is used over my custom template in my e-mail theme? This is not the case with htmlmail.tpl.php. Shouldn't the module give precedence to custom template files in the e-mail theme directory?

Removing htmlmail--user--password_reset.tpl.php in the htmlmail directory works, but this file will always be recreated when updating the module.

#4

If you have a file called htmlmail-user--password_reset.tpl.php in your e-mail theme directory, and it isn't getting used for password reset emails, then I want to hear about it.

The order of precedence should be:

  1. $theme_directory/htmlmail--$module--$key.tpl.php
  2. $module_directory/htmlmail--$module--$key.tpl.php
  3. $theme_directory/htmlmail--$module.tpl.php
  4. $module_directory/htmlmail--$module.tpl.php
  5. $theme_directory/htmlmail.tpl.php
  6. $module_directory/htmlmail.tpl.php

If that order is not being followed, please tell me and I'll try to fix the problem.

#5

Title:Template htmlmail.tpl.php can't be used for password recovery e-mail» Improve documentation on the order of precedence of theme suggestions.
Version:7.x-2.47» 7.x-2.x-dev
Category:support request» task
Status:postponed (maintainer needs more info)» needs work

#6

Isn't it a better idea to remove the htmlmail--user--password_reset.tpl.php file from the module entirely? This just serves as an example and places an additional burden on the users of the module.

I suspect the most common use case is to *not* have a customized user password email. To make this use case work as expected there are two options now:

  1. Remove the template file from the module folder. This is an additional step to take when installing the module, and as it needs to be redone on every module update it adds maintenance complexity.
  2. Maintain a separate template file in the theme folder, which adds unneeded extra work whenever changes are done to the email template.

I would not throw away this file, as it is useful as an example. But a better home for it would be inside a documentation page, and not in the module folder.

#7

Or maybe an examples folder.

#8

Isn't it just weird that templates in the module folder get preferred over the template folder? It shouldn't be necessary to change the module folder. Now I need to remove all template files from there to use a htmlmail.tpl.php in my theme folder.

Why not only search the module folder after all tries in the theme folder have failed? That would be a lot more logical and more in line with other systems.

The Module folder shouldn't be edited.