$user->get("usertype") is empty

This board for support questions on Joomla 1.6 RC (= Release Candidate - which should NOT be used on a production server) is NO longer active because Joomla 1.6.0 has been released.

>> For Joomla! 1.6 Support Questions, please use http://forum.joomla.org/viewforum.php?f=614 instead <<
Locked
greno
Joomla! Intern
Joomla! Intern
Posts: 89
Joined: Tue Feb 13, 2007 4:53 am

$user->get("usertype") is empty

Post by greno » Tue Aug 10, 2010 9:18 pm

In one of my scripts I use $user->get("usertype") and now under Joomla-1.6 Beta6 this is returning empty.

Generally it returns "Super Administrator" or "Administrator" for an admin.

Is this something to do with the new ACL system? If so, how should we be doing this now?

 
shafiqkr
Joomla! Apprentice
Joomla! Apprentice
Posts: 32
Joined: Sat Jul 24, 2010 8:47 am

Re: $user->get("usertype") is empty

Post by shafiqkr » Thu Feb 17, 2011 4:14 am

The data base structure have been changed...use the following code for this
$user =& JFactory::getUser();
$userid = $user->get( 'id' );
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('g.title AS group_name')
->from('#__usergroups AS g')
->leftJoin('jos_user_usergroup_map AS map ON map.group_id = g.id')
->where('map.user_id = '.(int) $userid);
$db->setQuery($query);
$ugp = $db->loadObject();
return $ugp->group_name;

 

Locked

Return to “Joomla! 1.6 RC Support [closed]”