One way to resolve this issue is to wrap this line with a statement to ensure that the array has not been set before trying to instantiate a new array.
ie.
if (! isset($users [$userrole->id] ['roles'] ))
{
$users[$userrole->id]['roles'] = array();
}
This will keep any previous roles array data, and allow multiple roles to be displayed.

Description

When viewing the Other users page for a Course, and a User has multiple roles, only 1 of the roles are displayed.

In issue is caused by line number 843 in moodle/enrol/locallib.php for Moodle Stable version 2.4.1 (possibly other versions). If multiple roles are evident for the same user, this line '$users[$userrole->id]['roles'] = array();' will recreate the roles array for each role iteration. If the roles array was created and populated for a previous iteration, the data is lost. It serves as a 'last in wins' situation.

Attachments

Issue Links

Discovered while testing

MDL-37638When cloning a role the default "Custom full name" is incorrect.