Display for logged in users
The following code will return TRUE for logged in users.
<?php
global $user;
return (bool) $user->uid;
?>To use this to only show to users that are NOT logged in you need to add an exclamation point (!) like so:
<?php
global $user;
return (bool) !$user->uid;
?>This check is no longer necessary in Drupal 5.x + since the block settings let you select who may view the block by role with check boxes.
