I have this code:
global $user;
if (!$user->uid) {
drupal_set_message("You must log in to view this content.");
drupal_goto('node/153', array('query'=>drupal_get_destination()));
}
$user->uid
evaluates correctly when logged in as admin and editor, but users that don't have admin or editor roles have NO UID. Immediately before and after this code resolves to false, I visit site-root/user, and sure enough, I'm logged in.
What setting causes this? I've used this code many times to see if a user is logged in, and I can't find any setting that would cause this behavior.