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.
I've found this problem that when an email address is subscribe to multiple simplenews mailouts the same (first) template will be used in all e-mails that go through simplenews template.
The attached patch seems to fix the problem. It simply switches around the detection of the tid - prioritising the newsletter tid over the user's account tid.
Comment | File | Size | Author |
---|---|---|---|
#9 | simplenews_template_682566.patch | 660 bytes | lavamind |
#2 | simplenews_template.module.rej_.txt | 985 bytes | Wuekkie |
simplenews-fix-wrong-template.patch | 770 bytes | miiimooo |
Comments
Comment #1
Wuekkie CreditAttribution: Wuekkie commentedcall to undefined function on line 106 dsm($tid)
Comment #2
Wuekkie CreditAttribution: Wuekkie commentedTried patching manually in my first post. Later tried patch.exe and got "Hunk #1 failed at 100" here is the reject file from patch.exe:
Comment #3
adam_b CreditAttribution: adam_b commentedsubscribing... any news re this?
Comment #4
Mac Clemmens CreditAttribution: Mac Clemmens commentedTry changing dsm to drupal_set_message() and that should resolve the issue. dsm() is a function available through the devel module, which fails if not enabled. You can probably also just delete that line.
--- simplenews_template.module.orig 2010-01-12 16:43:35.000000000 +0000
+++ simplenews_template.module 2010-01-12 16:50:25.000000000 +0000
@@ -100,12 +100,11 @@
*/
function _simplenews_template_mail_alter_simplenews_node(&$message) {
// Setup newsletter data
- $tid = reset($message['params']['context']['account']->tids);
- if (!empty($message['params']['context']['account']->tids)) {
- $tid = reset($message['params']['context']['account']->tids);
- } else {
$tid = $message['params']['context']['newsletter']->tid;
+ if (!$tid) {
+ $tid = reset($message['params']['context']['account']->tids);
}
$newsletter = taxonomy_get_term($tid);
$node = $message['params']['context']['node'];
$content = $message['body']['body'];
Comment #5
ikeigenwijs CreditAttribution: ikeigenwijs commentedsubscribe to
Comment #6
ikeigenwijs CreditAttribution: ikeigenwijs commentedpatch of nr 4 seemed to work.
i did not do this: Try changing dsm to drupal_set_message() and that should resolve the issue. dsm() is a function available through the devel module, which fails if not enabled. You can probably also just delete that line.
Experiencing problems with images in the head and footer, not displaying referenced as :
cid:cc512de8bb1bbd868a16bdf60922accf@www.revaki.ugent.be
on the image front the
extra dsm($tid);
made no difference
Comment #7
franzThe code changed up to now, please check if there is need to reroll the patch and reopen the issue if it's still active
Comment #9
lavamind CreditAttribution: lavamind commentedThis bug is still present in latest 6.x-1.x release (May 10 2010). If one email has multiple subscriptions to newsletters using templates, the template from the lowest-tid newsletter is used.
The code from the reporter's patch seems to work. I re-rolled the patch using the latest 6.x-1.x code and without the devel function call.
Comment #10
franzCommited, thanks!