简体   繁体   中英

Joomla 2.5 check user logged in

How do i check if a user is logged in in Joomla 2.5? I can only seem to find code snippets for the older versions of joomla. Is it the same?

if(JFactory::getUser()->id)
{
//user has logged in
}

Yes it same as before try this-

$user =& JFactory::getUser();
if($user->id!=0){
//user is logged in
}
$user = JFactory::getUser()->guest;

如果您使用的是PHP 5.3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM