A common question when using Drupal is "How do I show something only to users that are not logged in?" (or vice versa). This is the simple answer for snippets of content:
<?php
// You must include this next line
global $user;
// if visitor is not logged in
if (!$user->uid) {
// do something if not logged in
} else {
// do something else if logged in
}
?>I see many people searching this site for the answer to that. I hope someone finds it useful.