Simplenews is now dependant on Token to do it's token replacement yet simplenews_template beta-3 still looks for the old custom token replacement function in simplenews and throws an error when it doesn't find it. The missing function is "simplenews_mail_tokens".
This is only applicable to the latest code in Simplenews but I guess it will probably be released soon as it's been in there for a while.
I've included a patch but it needs a bit of work as it's not doing the token replacement correctly, the third argument to token_replace is probably insufficient. I don't want to do a node_load in there though as it'll start to eat up memory so any suggestions welcome. This is fine for my purposes as I don't need to use tokens in the header or footer anyway.
117,118c117
< $variables = simplenews_mail_tokens($user, $message['params']['context'], $language);
<
---
>
122c121
< $header = strtr($header, $variables);
---
> $header = token_replace($header, 'simplenews', array('node' => $node));
128c127
< $footer = strtr($footer, $variables);
---
> $footer = token_replace($footer, 'simplenews', array('node' => $node));
Comment | File | Size | Author |
---|---|---|---|
#2 | simplenews_template.640740.simplenews_6.x-2.x.patch | 1.37 KB | franz |
#1 | simplenews_template.640740.simplenews_6.x-2.x.patch | 1.4 KB | roball |
Comments
Comment #1
roball CreditAttribution: roball commentedThe workaround by johngriffin is attached as a patch file, so people can apply it easier by doing
Successfully tested, with the limitations pointed out above.
Comment #2
franzIt should be better then to use function_exists('simplenews_mail_tokens'), so it won't break compatibility.
Anyone willing to test this to see if it really tokenizes?
Also converted the patch to unix format...
Comment #3
AmstercadI had this same problem earlier, and google brought me to this page. Since someone checked in a CVS version for simplenews around Jan 1, I tried that, but the problem didn't go away. Then I applied this patch, and I am pleased to reply the problem went away. Thanks folks.
Comment #4
peterpoe CreditAttribution: peterpoe commentedConfirming that the patch fixes the problem.
Comment #5
Amarjit CreditAttribution: Amarjit commentedConfirm first patch also works.
Comment #6
franzImproved title. BTW, hadn't noticed the version was wrong on it.
I've added the dependency to the .info and applied the patch.
Thanks for the work!
Comment #8
muschpusch CreditAttribution: muschpusch commentedplease commit the patch...
Comment #9
muschpusch CreditAttribution: muschpusch commentedsorry this was already committed to the current dev release
Comment #10
tallsimon CreditAttribution: tallsimon commentedthank you for fixing this :-)