tags:

views:

598

answers:

1

In Joomla 1.0, the current User object was stored in a global variable called $my. This doesn't exist in Joomla 1.5 any more - how do I get that object? Also, how can you tell if the user hasn't logged in?

+3  A: 

Information found at http://docs.joomla.org/Accessing_the_current_user_object

$user =& JFactory::getUser();

And how to tell if they've logged in, or if they're just a guest:

if ($user->guest) {
    echo "Please log in.";
} else {
    echo "Welcome!";
}
nickf