Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-37559

Other Users page does not list all roles

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.4, 2.4.1, 2.5
    • Fix Version/s: 2.3.5, 2.4.2
    • Component/s: Roles / Access
    • Labels:
      None
    • Testing Instructions:
      Hide

      1/ clone manager role
      2/ assign manager and the cloned role to one user in the "Other users page" in some course
      3/ verify that after reload the page shows both roles

      Show
      1/ clone manager role 2/ assign manager and the cloned role to one user in the "Other users page" in some course 3/ verify that after reload the page shows both roles
    • Workaround:
      Hide

      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.

      Show
      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.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w03_MDL-37559_m25_otherusers

      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Mar/13