Show Simplenews block only to unsubscribed users

To show the Simplenews block only to unsubscribed users you have to configure the block and copy the code into the box below Page specific visibility settings. Make sure to select the last radio button (Show if the following PHP code returns TRUE).

<?php
global $user;
if (
$user->subscriptions_subscribe !=0){
    return
TRUE;
  } else {
    return
FALSE;
}
?>

Hope it helps!

This no longer works in 5.x,

facelikebambi - May 7, 2008 - 15:12

This no longer works in 5.x, but it can still be achieved by overriding theme_simplenews_block() instead.

In the override, I just added this (using phptemplate theme):

function phptemplate_simplenews_block($block) {
$output = '';
if ($block['subscribed'] != TRUE) { ..... original function code... }
return $output;
}

 
 

Drupal is a registered trademark of Dries Buytaert.