I'm looking for a conditional statement that will print information only if the user is logged on. If they are not logged on, another message will be returned.

Could someone please help me with the correct php for this?

Thanks in advance

~Adam

Comments

mdixoncm’s picture

<?php
  global $user; //declare the global user object
  if ($user->uid > 0) {
    print "user logged in";
  }
  else {
    print "user not logged in";
  }
?>

hopefully that should work ok ...

Good luck,

Mike

Like books? Check out booktribes the new (Drupal based) community for book lovers
from Computerminds