Question

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?

Was it helpful?

Solution

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!";
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top