Joomla 2.5 - JUser不返回用户组名称

时间:2012-07-05 09:17:05

标签: joomla

我想获取用户的用户组。我使用以下代码:

$CurrentUser =& JFactory::getUser();
print_r($CurrentUser->groups);

现在,在Joomla的1.5版中,它打印出这个数组:

数组([已注册] => 2 [作者] => 3 [RBGS_RBS_U15_Trainer] => 1063)

在v2.5中,我得到了这个:

数组([2] => 2 [3] => 3 [1063] => 1063)

那么在v2.5中是否有可能获取用户组的名称?

提前致谢,

enne

1 个答案:

答案 0 :(得分:0)

嗯,答案是改变一行代码。浏览到libraries / joomla / database / table / user.php。 在那里,改变行

$this->groups = $this->_db->loadAssocList('id', 'id');

$this->groups = $this->_db->loadAssocList('title', 'id');

它应该有用。

相关问题