Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 330
Sean Lang Avatar asked Nov 01 '12 09:11

Sean Lang


2 Answers

if(JFactory::getUser()->id)
{
//user has logged in
}
like image 52
Techie Avatar answered Sep 24 '22 15:09

Techie


Yes it same as before try this-

$user =& JFactory::getUser();
if($user->id!=0){
//user is logged in
}
like image 38
Irfan Avatar answered Sep 21 '22 15:09

Irfan