How to check if the user is logged in Drupal 6 using php

If you need more help on the topic feel free to add a comment or create a new post on the Forum

I needed this snippet of code in a block to show different links based on the user's logged in state.

  1. <?php
  2. global $user;
  3. if ($user->uid) {
  4.     print "logged in";
  5. }
  6. else if (!$user->uid) {
  7.     print "please log in";
  8. }
  9. ?>


Add new comment