How do i know when someone is logged in?
-
Ok..i give up searching for this solution. I need some help from you guys.
In a page template, I want to be able to show some message if user IS registered and logged in and something different if it?′s not.
I?′ve tried the following approach, wich uses a conditional to figure out if the user level is 0. The problem with this is that non-registered users also qualify as true for this code…
Am i doing something wrong? Is there a better approach, given the fact that I only need to know wether the user is logged in or not?
Thank you very much!
<?php
if ($user_level >= 0) {
?>“SHOW SOMETHING FOR REGISTERED USERS HERE”
<?php
} else {
?>“SHOW SOMETHING FOR NON-REGISTERED USERS HERE”
<?php
}
?>
- The topic ‘How do i know when someone is logged in?’ is closed to new replies.