nickf
nickf

Reputation: 546025

How do you get the current user object in Joomla 1.5?

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?

Upvotes: 0

Views: 1816

Answers (1)

nickf
nickf

Reputation: 546025

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!";
}

Upvotes: 5

Related Questions