?
avatar rbsl-mohit
rbsl-mohit
18 Sep 2014

Steps to reproduce the issue

try following code :
$user = JFactory::getUser();
var_dump($user->group);
var_dump(JUserHelper::getUserGroups($user->id));

Expected result

both should produce same results.

Actual result

null

and

array (size=1)
2 => string '2' (length=1)

System information (as much as possible)

Database Version : 5.5.38-0ubuntu0.14.04.1
PHP Version : 5.5.9-1ubuntu4.4
Web Server : Apache/2.4.7 (Ubuntu)
WebServer to PHP Interface : apache2handler
Joomla Version : Joomla! 3.3
Joomla Platform Version : Joomla Platform 13.1.0 Stable

Additional comments

avatar rbsl-mohit rbsl-mohit - open - 18 Sep 2014
avatar vdespa
vdespa - comment - 18 Sep 2014

$user->group is actually null, as it is not defined in the API.

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar jissues-bot
jissues-bot - comment - 18 Sep 2014

Set to "closed" on behalf of @vdespa by The JTracker Application at issues.joomla.org

avatar jissues-bot jissues-bot - close - 18 Sep 2014
avatar jissues-bot jissues-bot - close - 18 Sep 2014
avatar zero-24 zero-24 - close - 18 Sep 2014
avatar vdespa vdespa - change - 18 Sep 2014
Status New Expected Behaviour
avatar jissues-bot jissues-bot - change - 18 Sep 2014
Status Expected Behaviour Closed
Closed_Date 0000-00-00 00:00:00 2014-09-18 23:06:25
avatar bauer-git
bauer-git - comment - 25 Jan 2015

What about $user->groups (note plural) - should that be null also? Many 3rd party extensions reference it.

avatar vdespa
vdespa - comment - 26 Jan 2015

Yes, groups is defined.

see \libraries\joomla\user\user.php.
/**
* Associative array of user names => group ids
*
* @var array
* @since 11.1
*/
public $groups = array();

avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?

Add a Comment

Login with GitHub to post a comment