Check is Admin in Joomla 2.5

How to check if the user is an administrator

$user = JFactory::getUser();
$isroot = $user->get('isRoot');

OR

$usergroups = JAccess::getGroupsByUser(JFactory::getUser()->id);
    if ((in_array(7,$usergroups)) || (in_array(8,$usergroups)))
{
 // admin actions
}else{
// user actions 
}


Scroll to Top
Ads: