JUser Object problem - JFactory::getUser()

The support for Joomla 2.5 ended on December 31, 2014. Possible bugs in Joomla 2.5 will not be patched anymore. This forum has been closed. Please update your website to Joomla 3.x

Moderator: ooffick

Forum rules
Please use the official Bug Tracker to report a bug: https://issues.joomla.org
Locked
valix05
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Mar 28, 2011 12:59 pm

JUser Object problem - JFactory::getUser()

Post by valix05 » Fri Feb 24, 2012 10:38 am

First of all sorry if this problem has been mentioned previously, search function is down at this moment.

Problem description

I am using the JFactory::getUser() method to get the JUser Object so that later I can read the "groups" property.

The problem in Joomla 2.5.1 is that groups now returns an array with numbers for indexes like this:

Code: Select all

    
[groups] => Array
        (
            [8] => 8
            [9] => 9
        )
The same piece of code returned in Joomla 1.6.X, 1.7.X:

Code: Select all

    [groups] => Array
        (
            [Super Users] => 8
            [MyGroup] => 9
        )

The code to test this (in a component controller):

Code: Select all

	function test()
	{
		$user = JFactory::getUser();      
		echo "<pre>";    
		print_r($user);
		echo "</pre>";
		exit;
	}
So my problem is that in Joomla 2.5.1 I can't read the user groups name directly.

Looking forward for your feedback. Maybe it's just a problem by me.

valix05
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Mar 28, 2011 12:59 pm

Re: JUser Object problem - JFactory::getUser()

Post by valix05 » Thu Mar 08, 2012 9:43 am

Reported here:

http://joomlacode.org/gf/project/joomla ... m_id=28125

Fixed in Platform, but not in CMS (yet).


Locked

Return to “Joomla! 2.5 Bug Reporting”