Drupal Page Specific visibility settings

October 19, 2008 by hejian

Show block only to logged in user:

global $user;
if ($user->uid){
return true;
} else {
return false;
}

Show block only on specific node type:

$match = FALSE;
if (arg(0) == 'node' && is_numeric(arg(1))) {
$nid = arg(1);
$node = node_load(array('nid' => $nid));
$type = $node->type;
if ($type == 'story') {
$match = TRUE;
}
}
return $match;

Leave a Reply

You must be logged in to post a comment.

Wordpress template made by HeJian