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
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

Sutharsan - May 3, 2008 - 18:01
Status:active» fixed

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

facelikebambi - May 5, 2008 - 16:21
Status:fixed» active

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

Sutharsan - May 6, 2008 - 06:27

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

Sutharsan - July 8, 2008 - 07:29
Status:active» fixed

#5

Anonymous (not verified) - July 23, 2008 - 10:56
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.