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.
Issue:
Mimemail's use of token_replace in mimemail.module is such that if a token does not contain a replacement value, the token name is still spat out in the email.
Solution:
token_replace is defined as token_replace($text, array $data = array(), array $options = array()).
In the options aray, there is a 'clear' option which is "A boolean flag indicating that tokens should be removed from the final text if no replacement value can be generated."
I simply added this 'clear' option to all instances of token_replace() within mimemail.module, and in my test case it works as expected: No tokens in the email :)
Comment | File | Size | Author |
---|---|---|---|
#3 | mimemail-1702868-3.patch | 1.53 KB | sgabe |
proper-token-replace-1.patch | 1.51 KB | kid_icarus | |
Comments
Comment #1
obarillet CreditAttribution: obarillet commentedAn alternative solution is provided here: http://drupal.org/node/1559844#comment-6055722
It's a patch that applies to the Rules module itself and providing the same fix.
Comment #2
fullerja CreditAttribution: fullerja commentedThis doesn't get along well with Webform Conditionals. I think the issue is that when a field is not shown to the user, it is not in the submission as NULL, so the token is still rendered. Is there a way to tweak the logic so that that if a value is not found the token is not rendered rather than if the value is NULL the token is not rendered?
Comment #3
sgabe CreditAttribution: sgabe commentedThe attached patch has been committed.