Snippet for controlling block display
facelikebambi - May 3, 2008 - 15:15
| Project: | Simplenews |
| Version: | 5.x-1.2 |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Hi
I wanted to hide the subscribe block for users who had already subscribed, and this looked ideal.
I can't get it to work though - should it work, or is it out of date? Really like the idea of using the PHP block display settings for this if possible.
Thanks!

#1
This is at least out of date. I do not know about 4.7.x, but it certainly does not work in 5.x.
However you can use a variable $subscribed in theme_simplenews_block() to turn on/off the block content.
#2
Hi
Thanks for the info, but I created block-simplenews.tpl.php and tried using the $subscribed variable... but it doesn't seem to be available?
I inserted this into the .tpl to check and it wasn't listed:
<?php print var_export($variables, TRUE); ?>Am I missing something here? Apologies if this is due to my lack of Drupal understanding and not a Simplenews thing...
#3
What you are missing is the override of the theme function. See http://drupal.org/node/55126, under 'How to Name your Override Function'.
A block-simplenews.tpl.php is not required.
#4
#5
Automatically closed -- issue fixed for two weeks with no activity.