joomla/joomla-cms — Issue #114: Bug in JUserHelper class, setUserGroups method
Author: jamesmoey
Created: 2012-02-02 05:51:01+00:00
State: open

Affected Version:
- 1.7.2 or greater
- 2.5

In method setUserGroups, inside file libraries\joomla\user\helper.php

// Set the titles for the user groups.
for ($i = 0, $n = count($results); $i < $n; $i++) {
$user->groups[$results[$i]->id] = $results[$i]->title;
}

This code will overwrite the index of the groups parameter pass into the function. Also in the method addUserToGroup in this class, the group information is store as

// Add the group data to the user object.
$user->groups[$title] = $groupId;

not the otherway around.