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

CLONE -Assign Roles page - existing users is only sorted by last name, while potential users is sorted by last name then first name

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.1, 1.9.5, 1.9.10
    • Fix Version/s: 1.9.11
    • Component/s: Administration
    • Labels:
      None
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      When assigning roles, the potential uses column is sorted first by last name then by first name, while the existing users only sorts by last name.

      This is easily fixed by adding the sort option to the get_role_users like so:

      if (!$contextusers = get_role_users($roleid, $context, false, 'u.id, u.firstname, u.lastname, u.email, r.hidden','lastname ASC, firstname ASC'))

      { $contextusers = array(); }

        Gliffy Diagrams

        1. MDL-20607.patch
          0.8 kB
          Anthony Borrow
        1. mdl-20607-after.png
          152 kB
        2. mdl-20607-before.png
          152 kB

          Issue Links

            Activity

            Hide
            aborrow Anthony Borrow added a comment -

            Here is the simple patch (and some screen shots) which I believe will resolve this issue for 1.9. In HEAD, Tim's work was part of a larger project but this request is pretty specific and makes sense to me. I've attached a before and after screen shot to demonstrate - user Tom Castillo is an example of one that has a user id before one of the other Castillos and thus does not get completely sorted. Let me know if there are any concerns (possibly performance or otherwise) about checking this in. Essentially, the same thing is in HEAD so it is just applying this particular part to 1.9 which seems pretty trivial to me but I wanted to double check. Peace - Anthony

            Show
            aborrow Anthony Borrow added a comment - Here is the simple patch (and some screen shots) which I believe will resolve this issue for 1.9. In HEAD, Tim's work was part of a larger project but this request is pretty specific and makes sense to me. I've attached a before and after screen shot to demonstrate - user Tom Castillo is an example of one that has a user id before one of the other Castillos and thus does not get completely sorted. Let me know if there are any concerns (possibly performance or otherwise) about checking this in. Essentially, the same thing is in HEAD so it is just applying this particular part to 1.9 which seems pretty trivial to me but I wanted to double check. Peace - Anthony
            Hide
            aborrow Anthony Borrow added a comment -

            Nicolas - I've added you as a watcher to facilitate any comments you might have. I'm happy to apply the patch to 1.9 but wanted to check with someone like yourself first. Peace - Anthony

            Show
            aborrow Anthony Borrow added a comment - Nicolas - I've added you as a watcher to facilitate any comments you might have. I'm happy to apply the patch to 1.9 but wanted to check with someone like yourself first. Peace - Anthony
            Hide
            timhunt Tim Hunt added a comment -

            This does not affect 2.0, only 1.9.

            Show
            timhunt Tim Hunt added a comment - This does not affect 2.0, only 1.9.
            Hide
            aborrow Anthony Borrow added a comment -

            Tim - Thanks you are right, the get_role_users function in /lib/accesslib.php has the firstname secondary sort as a default value so the patch I'm proposing for 1.9 was already implemented in 2.0. I've removed 2.0 as an affected branch. Peace - Anthony

            Show
            aborrow Anthony Borrow added a comment - Tim - Thanks you are right, the get_role_users function in /lib/accesslib.php has the firstname secondary sort as a default value so the patch I'm proposing for 1.9 was already implemented in 2.0. I've removed 2.0 as an affected branch. Peace - Anthony

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  21/Feb/11