Domanda

I have the name of my user in $_SESSION["login"], and I'm trying to display this in Joomla, however shows the following "", and doesn't print anything.

In the PHP class, the variable appears correctly, but in Joomla it doesn't.

È stato utile?

Soluzione

If the end goal is to get information regarding the currently logged in user, you should simply use the below core utility function to grab the current User object with all the info you could need.

$user = JFactory::getUser();
echo $user->username;
echo $user->id;
echo $user->email;
// and so on

Altri suggerimenti

You can use session in joomla with: JFactory::getSession() as follow:

$session = &JFactory::getSession();
$session->set("login","session_value")

and to get this session

$session->get("login")

Thanks.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top