--- simplenews_template.orig 2009-11-11 12:11:12.000000000 -0500 +++ simplenews_template.module 2009-11-30 10:09:41.000000000 -0500 @@ -100,17 +100,19 @@ function simplenews_template_form_alter( */ 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; - } + $taxonomy = $message['params']['context']['node']->taxonomy; + $vid = variable_get('simplenews_vid', ''); + foreach($taxonomy as $term){ + if($term->vid == $vid){ + $newsletter = $term; + $tid = $term->tid; + break; + } + } - $newsletter = taxonomy_get_term($tid); $node = $message['params']['context']['node']; $content = $message['body']['body']; - + // Tokenize the header and footer: find the tokens global $language, $user; $context['node'] = $node; @@ -130,13 +132,13 @@ function _simplenews_template_mail_alter // Add headers and footer $content = theme('simplenews_template_content', $newsletter->name, $node->title, $header, $content, $footer); - + // Fetch Simplenews Template styling for this newsletter $style = _simplenews_template_get_css($tid); $bgcolor = _simplenews_template_get_bgcolor($tid); - if (is_null($message['body'])) { + if (!is_null($message['body'])) { // Markup node body with Simplenews Template style $content = theme('simplenews_template_mail', $newsletter->name, $node->title, $content, $style, $bgcolor); }