Moodle
  1. Moodle
  2. MDL-30472

Userlist in course is not sortable when lastaccess field is hidden

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.3, 2.2, 2.3
    • Fix Version/s: 2.1.4, 2.2.1
    • Component/s: Course
    • Labels:
    • Testing Instructions:
      Hide
      1. Login as admin and from settings Hide "last access" filed (Search for setting hiddenuserfields)
      2. Make sure you have at-least 3-4 student users enrolled to the course
      3. goto something like http://YOURMOODLEURL/user/index.php?id=COURSEID
      4. make sure the result is sortable and is sorted by "First name ASC be default"
      Show
      Login as admin and from settings Hide "last access" filed (Search for setting hiddenuserfields) Make sure you have at-least 3-4 student users enrolled to the course goto something like http://YOURMOODLEURL/user/index.php?id=COURSEID make sure the result is sortable and is sorted by "First name ASC be default"
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull Master Branch:
      MDL-30472-master
    • Rank:
      33142

      Description

      On http://YOURMOODLEURL/user/index.php?id=COURSEID there is a participants list of the selected course. By default, it is sorted by the lastaccess field. But when the lastaccess field is hidden to the user with the help of $CFG->hiddenuserfields, the list seems unsorted (or sorted by database ids).

      Furthermore, when lastaccess field is hidden, the user cannot sort the user list manually.

      We would like to suggest to improve this by replacing in /user/index.php

      if (!isset($hiddenfields['lastaccess'])) {
          $table->sortable(true, 'lastaccess', SORT_DESC);
      }
      

      with

      if (!isset($hiddenfields['lastaccess'])) {
          $table->sortable(true, 'lastaccess', SORT_DESC);
      }
      else {
          $table->sortable(true, 'lastname', SORT_ASC);
      }
      

      Thanks in advance.

        Activity

        Hide
        Michael de Raadt added a comment -

        Thanks to you!

        Show
        Michael de Raadt added a comment - Thanks to you!
        Hide
        Ankit Agarwal added a comment -

        up for review
        Thanks

        Show
        Ankit Agarwal added a comment - up for review Thanks
        Hide
        Jason Fowler added a comment -

        That's a nice fix

        Show
        Jason Fowler added a comment - That's a nice fix
        Hide
        Ankit Agarwal added a comment -

        Thanks Jason for the review.
        Up for integration
        Thanks

        Show
        Ankit Agarwal added a comment - Thanks Jason for the review. Up for integration Thanks
        Hide
        Aparup Banerjee added a comment -

        Thanks for this patch. integrated.

        (i suppose no one will hide too many fields and hope for sorting still :-p)

        Show
        Aparup Banerjee added a comment - Thanks for this patch. integrated. (i suppose no one will hide too many fields and hope for sorting still :-p)
        Hide
        Rossiani Wijaya added a comment -

        This is working great.

        Show
        Rossiani Wijaya added a comment - This is working great.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Whoever decided one week was worth 14 days had really one bad idea. Anyway, the nightmare is over, so thanks for your, once again, amazing contributions. Many, many thanks!

        Now... disconnect, relax and enjoy the next days, yay!

        Closing...ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Whoever decided one week was worth 14 days had really one bad idea. Anyway, the nightmare is over, so thanks for your, once again, amazing contributions. Many, many thanks! Now... disconnect, relax and enjoy the next days, yay! Closing...ciao

          People

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

            Dates

            • Created:
              Updated:
              Resolved: