Hi there,

I'm trying to add a link to the newsletter post to the bottom of my email. In documentation it says:

   Theme newsletter footer:
      simplenews-newsletter-footer.tpl.php (for all newsletters)

Here's the code I have in simplenews-newsletter-footer.tpl.php in my theme folder:

<?php if ($format == 'html'): ?>
  <p class="newsletter-footer">To post comments, <a href='[simplenews-newsletter-url]'>see this post online</a>.<br/><br/><a href="[simplenews-unsubscribe-url]"><?php print $unsubscribe_text ?></a></p>
<?php else: ?>
-- 
See this post online: [simplenews-newsletter-url]
<?php print $unsubscribe_text ?>: [simplenews-unsubscribe-url]
<?php endif ?>

<?php if ($key == 'test'): ?>
- - - <?php print $test_message ?> - - -
<?php endif ?>

The footer is not sent out with the newsletter test. I tried changing the filename to simplenews-footer.tpl.php with same results.

Am I missing something obvious here?

Thanks,
Andrey.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

miro_dietiker’s picture

Status: Active » Postponed (maintainer needs more info)

Please provide more details
- Do you use a admin theme?
- Did you clear the theming cache after adding?

Additionally sending via cron might result in different results than test sending - depending base_url and admin_theme...

All of those are reasons that could trigger some issue. There are other issues in the tracker that each partially cover those topics.

mr.andrey’s picture

Hi there,

I use the same theme for both admin and normal users.

I just cleared the cache* tables and rebuilt theme registry.

I tried both using the non-cron "test" to one email address, and the full cron mailing.

No footer.

Using "simplenews-newsletter-footer.tpl.php" in my zen-based theme folder (other non-simplenews tpl overrides work fine). The content type is default and titled "simplenews".

Andrey.

mr.andrey’s picture

Status: Postponed (maintainer needs more info) » Active

Any other information that you need?

mr.andrey’s picture

Found the issue.

The following code in simplenews.module is problematic:

        if (variable_get('simplenews_opt_inout_'. $tid, 'double') != 'hidden') {
          // Build and buffer message footer
          $footer = theme(array('simplenews_newsletter_footer__'. $context['node']->simplenews['tid'], 'simplenews_newsletter
_footer'), $context['node'], $key, $message['language']);
          $messages[$nid][$langcode]['footer'] = $footer;
        }

... because it disables the footer if the opt-in method is set to "Hidden". The footer may actually contain other information besides the unsubscribe variables (like the "test" newsletter message), so wouldn't it be better to just unset those variables rather than disable the footer tpl file altogether?

I'll try to work with the body tpl instead for my needs.

Best,
Andrey.

garyg’s picture

The first newsletter created will not include the footer any longer.
simplenews-newsletter-footer.tpl.php

All new newsletters I now create have no problem including the footer.

I have looked all day for something to fix but I can't find any problems.
Not using an admin theme. Learned to avoid that with simplenews.
I used to have the template module installed, but its turned off now.

I would just re-create the newsletter but I think it would throw off my news archives
that using that taxonomy term.

Simplenews 6.x-1.3
Any help here would be appreciated.

miro_dietiker’s picture

Use 6.x-2.x.and report again.

:-)

Note that after an update to the current 6.x-2.x you need to clear the cache since we changed some theming signature in the footer.

garyg’s picture

I updated to Simplenews 6.x-2.0-alpha1
I disabled simplenews template and register and kept simplenews roles
This did not resolve the missing footer (cache is cleared) in the main newletter
The footer continues to include just fine if it is sent using the newly created newsletter

Also the icons for sent, published and cron showed up at first but after the sending
completed for an issue (admin manual cron) the icons are now all missing.

roball’s picture

As far as I know 6.x-2.0-alpha1 is broken and there has yet not been committed a fix for it .

miro_dietiker’s picture

Roball, the broken part is just about reliability of sending process and send trigger.

That's nothing to do with footer and icons.
Please investigate and provide fixes for those new issues!

roball’s picture

Title: footer.tpl.php is not being included » simplenews-newsletter-footer.tpl.php is not being included in hidden newsletters
Category: support » bug

I can confirm the problem mentioned in #4. If the Opt-in/out method of a newsletter is set to Hidden (at admin/content/simplenews/types/edit/[TID]), then no footer is never being sent out. Instead the module should just not generate any unsubscribe URLs, but still honour the footer template file (simplenews-newsletter-footer.tpl.php). It may contain other information such as copyright etc.

miro_dietiker’s picture

Title: simplenews-newsletter-footer.tpl.php is not being included in hidden newsletters » include simplenews-newsletter-footer.tpl.php in hidden newsletters
Category: bug » feature

roball

The rendering of the mail is identical to 6.x-1.x.
We didn't have enough resources to redefine the rendering for 6.x-2.x. So it is still by intention to supporess the footer completely in case of a hidden newsletter.
We should document this behaviour of the current release.

Instead i consider your preference as a feature request.

miro_dietiker’s picture

Issue tags: +Needs documentation

needs documentation then...

roball’s picture

Yes, it's a feature request. Thanks for considering to document this behaviour more clearly.

Simon Georges’s picture

Status: Active » Needs review
FileSize
2.99 KB

First attempt at a patch.

Berdir’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)

Noticed the same while fixing #1388948: Multiple Notices When Sending a Test Newsletter. Moving over to 7.x-1.x to have it fixed there first.

Berdir’s picture

Attached is a patch for 7.x-1.x.

Patch contains also a few related refactorings.

The linked issue above already added tests to make sure that there is no unsubscribe link, so this is covered by tests..

Berdir’s picture

Status: Patch (to be ported) » Needs review
Berdir’s picture

Issue tags: -Needs documentation

removing needs documentation tag.

Berdir’s picture

Version: 7.x-1.x-dev » 6.x-2.x-dev

Committed, back to 6.x-2.x.

Berdir’s picture

Status: Needs review » Patch (to be ported)
espurnes’s picture

I get this messages when I send a newsletter to the test address. The theme is Omega but the
I'm using:
drupal 7.12
Mime Mail 7.x-1.0-alpha1
Simplenews 7.x-1.0-beta2
Omega - Responsive HTML5 Base Theme 7.x-3.1

Notice: Trying to get property of non-object a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Warning: Invalid argument supplied for foreach() a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Notice: Trying to get property of non-object a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Warning: Invalid argument supplied for foreach() a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Notice: Trying to get property of non-object a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Warning: Invalid argument supplied for foreach() a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Notice: Trying to get property of non-object a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Warning: Invalid argument supplied for foreach() a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Notice: Trying to get property of non-object a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Warning: Invalid argument supplied for foreach() a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Notice: Trying to get property of non-object a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Warning: Invalid argument supplied for foreach() a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Notice: Trying to get property of non-object a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Warning: Invalid argument supplied for foreach() a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Notice: Trying to get property of non-object a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
Warning: Invalid argument supplied for foreach() a alpha_invoke() (línia 99 de /home/.../sites/all/themes/omega/alpha/includes/alpha.inc).
michka’s picture

Version: 6.x-2.x-dev » 7.x-1.0-beta2

Hi,

I have exactly the same problem !

Berdir’s picture

Version: 7.x-1.0-beta2 » 6.x-2.x-dev

That has nothing to do with this issue, please open a new one.

  • Berdir committed 7f6bde6 on 8.x-1.x
    Issue #841966 by Berdir: Follow-up, move opt_out_hidden to the correct...
  • Berdir committed b3e18b9 on 8.x-1.x
    Issue #841966 by Berdir, Simon Georges: Added footer to newsletters of...