Moodle
  1. Moodle
  2. MDL-26956

Need to be able to search for user in 'Enrolled Users'

    Details

    • Testing Instructions:
      Hide

      1. In the administration menu, choose Site administration / Users / Accounts / Upload users.
      2. Upload the attached testusers.csv file.
      3. Create a new course with a name and short name of your choosing; leave other settings default.
      4. Enrol all of the 'Another body' users with Student role. (This is a bit tedious, at least the way I did it you just have to click 'Enrol' 101 times...)
      5. The other users are called 'Doe', 'Dewar', or 'Anne Other'. Enrol these with Teacher role.
      (Phew, there are finally 2 pages on the list.)
      6. Close the enrol popup and wait for the page to reload.

      EXPECTED (same as before): The main heading shows 106 enrolled users. There are 2 pages with the first page displayed.
      EXPECTED (new): At the top of the page a box with a faint grey background (same grey as table rows) contains a number of filter options.

      7. Experiment with resizing the browser window to different widths.

      EXPECTED: The filter box should appear alongside the 'Enrol users' button when there is room. When there is less room it will drop down to the line below.

      8. Type '26' in the search box and press Return or click Filter.

      EXPECTED: List should now show 'Another Body 26' only. There are no paging controls. Heading at the top says '1 enrolled users' [sic]

      9. Click Reset.

      EXPECTED: Page should reload as before with no filter options selected.

      10. Under 'Enrolment methods', select 'Guest access' and click Filter.

      EXPECTED: No users are now shown. (Note: This dropdown is the only one which was there in the previous interface.)

      11. Change 'Enrolment methods' back to 'All', select 'Teacher' under the 'Role' column, and click Filter.

      EXPECTED: Only the 5 teachers are now displayed.

      12. Type 'a' in the search box, select 'Manual' in the method box, and select 'Student' in the role box, then click Filter.

      EXPECTED: There are now 101 users who match all these criteria, which is enough to enable paging.

      13. Go to page 2 by clicking the '2' or 'Next' link (these are the same).

      EXPECTED: Page 2 shows only one result (because there are only 101 who matched the conditions).
      EXPECTED: The form fields in the filter box still contain the values they were set to before (a, manual, student).

      Show
      1. In the administration menu, choose Site administration / Users / Accounts / Upload users. 2. Upload the attached testusers.csv file. 3. Create a new course with a name and short name of your choosing; leave other settings default. 4. Enrol all of the 'Another body' users with Student role. (This is a bit tedious, at least the way I did it you just have to click 'Enrol' 101 times...) 5. The other users are called 'Doe', 'Dewar', or 'Anne Other'. Enrol these with Teacher role. (Phew, there are finally 2 pages on the list.) 6. Close the enrol popup and wait for the page to reload. EXPECTED (same as before): The main heading shows 106 enrolled users. There are 2 pages with the first page displayed. EXPECTED (new): At the top of the page a box with a faint grey background (same grey as table rows) contains a number of filter options. 7. Experiment with resizing the browser window to different widths. EXPECTED: The filter box should appear alongside the 'Enrol users' button when there is room. When there is less room it will drop down to the line below. 8. Type '26' in the search box and press Return or click Filter. EXPECTED: List should now show 'Another Body 26' only. There are no paging controls. Heading at the top says '1 enrolled users' [sic] 9. Click Reset. EXPECTED: Page should reload as before with no filter options selected. 10. Under 'Enrolment methods', select 'Guest access' and click Filter. EXPECTED: No users are now shown. (Note: This dropdown is the only one which was there in the previous interface.) 11. Change 'Enrolment methods' back to 'All', select 'Teacher' under the 'Role' column, and click Filter. EXPECTED: Only the 5 teachers are now displayed. 12. Type 'a' in the search box, select 'Manual' in the method box, and select 'Student' in the role box, then click Filter. EXPECTED: There are now 101 users who match all these criteria, which is enough to enable paging. 13. Go to page 2 by clicking the '2' or 'Next' link (these are the same). EXPECTED: Page 2 shows only one result (because there are only 101 who matched the conditions). EXPECTED: The form fields in the filter box still contain the values they were set to before (a, manual, student).
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      16586

      Description

      We have some courses with potentially thousands of students, and to locate a user in "Enrolled Users" is currently very cumbersome and time consuming, having to sort by firstname/lastname etc.

      Could we please have a search box added, this would be of great help with many hundreds of users here.

        Issue Links

          Activity

          Hide
          Helen Foster added a comment -

          Eddie, thanks for your report. There is an enrolled users search in Moodle 2.0 but it's not so easy to find! If you go to Settings > Course administration > Users > Enrolment methods then click the enrol users icon in the edit column for manual enrolments you'll find it.

          Suggestions for a more friendly user interface are most welcome!

          Show
          Helen Foster added a comment - Eddie, thanks for your report. There is an enrolled users search in Moodle 2.0 but it's not so easy to find! If you go to Settings > Course administration > Users > Enrolment methods then click the enrol users icon in the edit column for manual enrolments you'll find it. Suggestions for a more friendly user interface are most welcome!
          Hide
          Yvonne Hamilton added a comment -

          I am trying to find out if the 'order by' options for enrolled users within a course has been improved. In 1.9 we could order by 'Last Access' and 'Roles' but now we can only order by FirstName/Surname/Email address which is so limiting. Has there been any improvements on this since 2.1?

          Show
          Yvonne Hamilton added a comment - I am trying to find out if the 'order by' options for enrolled users within a course has been improved. In 1.9 we could order by 'Last Access' and 'Roles' but now we can only order by FirstName/Surname/Email address which is so limiting. Has there been any improvements on this since 2.1?
          Hide
          Nagi Saeed added a comment -

          Hi,

          I'm in the same boat as Eddie and agree a search tool would make the page so much powerful and easy to use. Even a filtering tool by first name and Surname like the one on the Participants page would be a great improvement.

          The Search tool under Enrolment methods although handy, doesn't tell much about the user (group, enrolment duration, rolls etc.)

          Show
          Nagi Saeed added a comment - Hi, I'm in the same boat as Eddie and agree a search tool would make the page so much powerful and easy to use. Even a filtering tool by first name and Surname like the one on the Participants page would be a great improvement. The Search tool under Enrolment methods although handy, doesn't tell much about the user (group, enrolment duration, rolls etc.)
          Hide
          Paul Haddad added a comment -

          I agree very much, if you have more than 100 users it is close to impossible to find them and be able to edit their roles etc. Please add this function to the upcoming releases.
          Thank you

          Show
          Paul Haddad added a comment - I agree very much, if you have more than 100 users it is close to impossible to find them and be able to edit their roles etc. Please add this function to the upcoming releases. Thank you
          Hide
          Nadav Kavalerchik added a comment -

          We have courses with 1800+ students. and Teachers find it very difficult to locate student(s) in the following pages:

          • Participants (enrol/users.php)
          • Quiz & Assignment (when searching a student in the grading page that list users who submitted their assignment)

          Implementing an AJAX search (filter) textbox, at the top of the users list, to filter it. Like done in block_quickfindlist could help improve the difficulty and probably solve this issue.

          Show
          Nadav Kavalerchik added a comment - We have courses with 1800+ students. and Teachers find it very difficult to locate student(s) in the following pages: Participants (enrol/users.php) Quiz & Assignment (when searching a student in the grading page that list users who submitted their assignment) Implementing an AJAX search (filter) textbox, at the top of the users list, to filter it. Like done in block_quickfindlist could help improve the difficulty and probably solve this issue.
          Hide
          vinod added a comment -

          It would be nice if we could have either search box/filtering facilities for enrolled users.

          Show
          vinod added a comment - It would be nice if we could have either search box/filtering facilities for enrolled users.
          Hide
          Sam Marshall added a comment -

          I'm going to have a go at coding this today for 2.5, we'll see how it works out...

          Show
          Sam Marshall added a comment - I'm going to have a go at coding this today for 2.5, we'll see how it works out...
          Hide
          Sam Marshall added a comment -

          I've done code for this and a test script. Preparing code ready for review (Tim has volunteered to review since I ripped off a function he wrote from the user selector.)

          Show
          Sam Marshall added a comment - I've done code for this and a test script. Preparing code ready for review (Tim has volunteered to review since I ripped off a function he wrote from the user selector.)
          Hide
          Tim Hunt added a comment -

          1. Should it be a grey background for the new settings? Moodle core more often uses grey borders?

          2. Should you test for 'exact matches sorted first' functionality in the testing instructions?

          3. Actually, have you implemented that? You should.

          4. Ages ago, there was a discussion about adding an $mform->render() method, so you could do
          $content .= $mform->render();
          rather than having to write the ob_ code your- (and everyone else's-) self. Would you like to do this now?

          5. You should not leave commented out code like
          //$content .= $this->output->render($table->get_enrolment_type_filter());
          particularly wiht the wrong punctuation.

          Show
          Tim Hunt added a comment - 1. Should it be a grey background for the new settings? Moodle core more often uses grey borders? 2. Should you test for 'exact matches sorted first' functionality in the testing instructions? 3. Actually, have you implemented that? You should. 4. Ages ago, there was a discussion about adding an $mform->render() method, so you could do $content .= $mform->render(); rather than having to write the ob_ code your- (and everyone else's-) self. Would you like to do this now? 5. You should not leave commented out code like //$content .= $this->output->render($table->get_enrolment_type_filter()); particularly wiht the wrong punctuation.
          Hide
          Sam Marshall added a comment -

          Thanks Tim. Regarding these questions:

          1. I tried with the grey borders but it makes it hard to read and messy - it looks OK for large things like the table but terrible for small things with controls close to the edge. Moodle core does use the same grey background for alternate table rows, I think it's okay as default behaviour. (Personally I would've chosen a more visible shade, but anyhow, people can customise this in themes if required.)

          2/3. I haven't implemented 'exact matches first' - the sorting code is unchanged. I considered it but think it's inappropriate because the table has sorting functionality already and this would defeat it. (I think this is consistent with other cases - we only do 'exact matches first' when there isn't an explicit sort option.)

          4. OK then, I'll code this as an earlier commit in the branch.

          5. Ooops, sorry, missed this when checking back, will fix.

          Show
          Sam Marshall added a comment - Thanks Tim. Regarding these questions: 1. I tried with the grey borders but it makes it hard to read and messy - it looks OK for large things like the table but terrible for small things with controls close to the edge. Moodle core does use the same grey background for alternate table rows, I think it's okay as default behaviour. (Personally I would've chosen a more visible shade, but anyhow, people can customise this in themes if required.) 2/3. I haven't implemented 'exact matches first' - the sorting code is unchanged. I considered it but think it's inappropriate because the table has sorting functionality already and this would defeat it. (I think this is consistent with other cases - we only do 'exact matches first' when there isn't an explicit sort option.) 4. OK then, I'll code this as an earlier commit in the branch. 5. Ooops, sorry, missed this when checking back, will fix.
          Hide
          Tim Hunt added a comment -

          +1 from me now. Submitting for integration.

          Show
          Tim Hunt added a comment - +1 from me now. Submitting for integration.
          Hide
          Damyon Wiese added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          Thanks!

          Show
          Damyon Wiese added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. Thanks!
          Hide
          Sam Marshall added a comment -

          Note: I rebased the branch on current master (and also improved the commit messages while I was there).

          Show
          Sam Marshall added a comment - Note: I rebased the branch on current master (and also improved the commit messages while I was there).
          Hide
          Dan Poltawski added a comment -

          Hi Sam,

          Thankyou for taking this on! Long overdue.

          But i'm stopping this for now because its throwing debugging regarding missing PARAM_ types (yes! maybe my debugging check was worth the pain..).

          Did you remember to call setType() for 'search'? Defaulting to PARAM_RAW cleaning.
          line 1291 of /lib/formslib.php: call to debugging()
          line 919 of /lib/formslib.php: call to moodleform->detectMissingSetType()
          line 934 of /lib/formslib.php: call to moodleform->display()
          line 61 of /enrol/renderer.php: call to moodleform->render()
          line 227 of /enrol/users.php: call to core_enrol_renderer->render_course_enrolment_users_table()
          Did you remember to call setType() for 'id'? Defaulting to PARAM_RAW cleaning.
          line 1291 of /lib/formslib.php: call to debugging()
          line 919 of /lib/formslib.php: call to moodleform->detectMissingSetType()
          line 934 of /lib/formslib.php: call to moodleform->display()
          line 61 of /enrol/renderer.php: call to moodleform->render()
          line 227 of /enrol/users.php: call to core_enrol_renderer->render_course_enrolment_users_table()

          Show
          Dan Poltawski added a comment - Hi Sam, Thankyou for taking this on! Long overdue. But i'm stopping this for now because its throwing debugging regarding missing PARAM_ types (yes! maybe my debugging check was worth the pain..). Did you remember to call setType() for 'search'? Defaulting to PARAM_RAW cleaning. line 1291 of /lib/formslib.php: call to debugging() line 919 of /lib/formslib.php: call to moodleform->detectMissingSetType() line 934 of /lib/formslib.php: call to moodleform->display() line 61 of /enrol/renderer.php: call to moodleform->render() line 227 of /enrol/users.php: call to core_enrol_renderer->render_course_enrolment_users_table() Did you remember to call setType() for 'id'? Defaulting to PARAM_RAW cleaning. line 1291 of /lib/formslib.php: call to debugging() line 919 of /lib/formslib.php: call to moodleform->detectMissingSetType() line 934 of /lib/formslib.php: call to moodleform->display() line 61 of /enrol/renderer.php: call to moodleform->render() line 227 of /enrol/users.php: call to core_enrol_renderer->render_course_enrolment_users_table()
          Hide
          Tim Hunt added a comment -

          Sam is on leave this week, so I will look at this and sort it out later today.

          Show
          Tim Hunt added a comment - Sam is on leave this week, so I will look at this and sort it out later today.
          Hide
          Dan Poltawski added a comment -

          Thanks Tim

          Show
          Dan Poltawski added a comment - Thanks Tim
          Hide
          Tim Hunt added a comment -
          Show
          Tim Hunt added a comment - OK, extra commit https://github.com/timhunt/moodle/compare/master...MDL-26956
          Hide
          Dan Poltawski added a comment -

          Thanks Tim/Sam, integrated to master.

          Show
          Dan Poltawski added a comment - Thanks Tim/Sam, integrated to master.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Can this be the cause for this recent error, only happening @ integration.git:

          Debug info: Argument 6 passed to users_search_sql() must be of the type array, null given, called in [dirroot]/user/selector/lib.php on line 438 and defined
          
          Stack trace:
          line 406 of /lib/setuplib.php: coding_exception thrown
          line 219 of /lib/datalib.php: call to default_error_handler()
          line 438 of /user/selector/lib.php: call to users_search_sql()
          line 114 of /cohort/locallib.php: call to user_selector_base->search_sql()
          line 210 of /user/selector/lib.php: call to cohort_existing_selector->find_users()
          line 110 of /cohort/assign.php: call to user_selector_base->display()
          

          it's reproducible with the non-js version of assign roles (manual enrolments) and also in the frontpage by looking to users->permissions->assigned roles->click on any.

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Can this be the cause for this recent error, only happening @ integration.git: Debug info: Argument 6 passed to users_search_sql() must be of the type array, null given, called in [dirroot]/user/selector/lib.php on line 438 and defined Stack trace: line 406 of /lib/setuplib.php: coding_exception thrown line 219 of /lib/datalib.php: call to default_error_handler() line 438 of /user/selector/lib.php: call to users_search_sql() line 114 of /cohort/locallib.php: call to user_selector_base->search_sql() line 210 of /user/selector/lib.php: call to cohort_existing_selector->find_users() line 110 of /cohort/assign.php: call to user_selector_base->display() it's reproducible with the non-js version of assign roles (manual enrolments) and also in the frontpage by looking to users->permissions->assigned roles->click on any. Ciao
          Hide
          Dan Poltawski added a comment -

          Yay behat!

          Show
          Dan Poltawski added a comment - Yay behat!
          Hide
          David Monllaó added a comment -

          In integration master using a mysql database, going to Site administration / ► Users / ► Permissions / ► Assign system roles I see an error

          Coding error detected, it must be fixed by a programmer: PHP catchable fatal error
          More information about this error
          
          Debug info: Argument 6 passed to users_search_sql() must be of the type array, null given, called in [dirroot]/user/selector/lib.php on line 438 and defined
          Error code: codingerror
          Stack trace:
          line 406 of /lib/setuplib.php: coding_exception thrown
          line 219 of /lib/datalib.php: call to default_error_handler()
          line 438 of /user/selector/lib.php: call to users_search_sql()
          line 1372 of /admin/roles/lib.php: call to user_selector_base->search_sql()
          line 210 of /user/selector/lib.php: call to existing_role_holders->find_users()
          line 196 of /admin/roles/assign.php: call to user_selector_base->display()
          

          Behat tests related with this are also failing.

          Show
          David Monllaó added a comment - In integration master using a mysql database, going to Site administration / ► Users / ► Permissions / ► Assign system roles I see an error Coding error detected, it must be fixed by a programmer: PHP catchable fatal error More information about this error Debug info: Argument 6 passed to users_search_sql() must be of the type array, null given, called in [dirroot]/user/selector/lib.php on line 438 and defined Error code: codingerror Stack trace: line 406 of /lib/setuplib.php: coding_exception thrown line 219 of /lib/datalib.php: call to default_error_handler() line 438 of /user/selector/lib.php: call to users_search_sql() line 1372 of /admin/roles/lib.php: call to user_selector_base->search_sql() line 210 of /user/selector/lib.php: call to existing_role_holders->find_users() line 196 of /admin/roles/assign.php: call to user_selector_base->display() Behat tests related with this are also failing.
          Hide
          Tim Hunt added a comment -
          Show
          Tim Hunt added a comment - New commit on https://github.com/timhunt/moodle/compare/master...MDL-26956 ready for integration.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          New changes pushed to integration, sending this back to testing, thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - New changes pushed to integration, sending this back to testing, thanks!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Just to confirm that both human inspection and MDL-38619 are now getting the roles assign page back to work. So normal testing of this can proceed.

          Show
          Eloy Lafuente (stronk7) added a comment - Just to confirm that both human inspection and MDL-38619 are now getting the roles assign page back to work. So normal testing of this can proceed.
          Hide
          David Monllaó added a comment -

          All working as expected, it passes, I've just noticed a couple of little things:

          • The enrolment methods select box seems to small to contain options like "Manual enrolments"
          • The roles select box is full of options but I see no role names on it, if I add a custom role name then the custom name is displayed, I'm not sure if this is an issue with my site as I remember to experience something similar last week or two weeks ago
          Show
          David Monllaó added a comment - All working as expected, it passes, I've just noticed a couple of little things: The enrolment methods select box seems to small to contain options like "Manual enrolments" The roles select box is full of options but I see no role names on it, if I add a custom role name then the custom name is displayed, I'm not sure if this is an issue with my site as I remember to experience something similar last week or two weeks ago
          Hide
          Tim Hunt added a comment -

          David, I don't understand you second point. Please give us a screen-grab. (And, did you do something with the role rename part of the course settings?)

          I suggest you create a separate bug (assigned to sam) for the first bullet point.

          Show
          Tim Hunt added a comment - David, I don't understand you second point. Please give us a screen-grab. (And, did you do something with the role rename part of the course settings?) I suggest you create a separate bug (assigned to sam) for the first bullet point.
          Hide
          David Monllaó added a comment -

          I can't add a screenshot with the dropdown menu expanded but I guess you can have an idea of what happens reading the DOM select node children.

          I haven't edited the role names section of the course (mdl_role_names is empty) and the name field of mdl_role only contains the overridden default values, anyway it doesn't seem to be related with this issue

          Show
          David Monllaó added a comment - I can't add a screenshot with the dropdown menu expanded but I guess you can have an idea of what happens reading the DOM select node children. I haven't edited the role names section of the course (mdl_role_names is empty) and the name field of mdl_role only contains the overridden default values, anyway it doesn't seem to be related with this issue
          Hide
          Tim Hunt added a comment -

          David, the code here is just calling get_all_roles, which is just doing simple SQL to get the roles. I can't see why it is breaking for you, but I think you should investigate and work it out. Start adding debugging at line 160 of enrol/users_forms.php.

          I acutally wonder if the code here should be using role_get_names.

          Anwyay, this is a separate issue.

          Show
          Tim Hunt added a comment - David, the code here is just calling get_all_roles, which is just doing simple SQL to get the roles. I can't see why it is breaking for you, but I think you should investigate and work it out. Start adding debugging at line 160 of enrol/users_forms.php. I acutally wonder if the code here should be using role_get_names. Anwyay, this is a separate issue.
          Hide
          David Monllaó added a comment -

          Thanks Tim, I've done all this, that's why I told you that my mdl_role table has '' values in name field, what I don't understand is why I'm the only one to experience this problem

          Show
          David Monllaó added a comment - Thanks Tim, I've done all this, that's why I told you that my mdl_role table has '' values in name field, what I don't understand is why I'm the only one to experience this problem
          Hide
          Dan Poltawski added a comment -

          I'm seeing the same with blank roles - please create a new bug for it.

          Show
          Dan Poltawski added a comment - I'm seeing the same with blank roles - please create a new bug for it.
          Hide
          Dan Poltawski added a comment -

          Actually I think that the lack of role names is a regression in this issue caused by changes in MDL-8249. Not surprising given the documentation doesn't help at all, but I think role_fix_names() is required form get_all_roleS().

          Show
          Dan Poltawski added a comment - Actually I think that the lack of role names is a regression in this issue caused by changes in MDL-8249 . Not surprising given the documentation doesn't help at all, but I think role_fix_names() is required form get_all_roleS().
          Hide
          Dan Poltawski added a comment -

          Did you remember to call thankDevelopers() for 'this_weeks_work'? Defaulting to PARAM_SHODDY thanking.

          line 1289 of \lib\changes.php: call to debugging()
          line 281 of \lib\are.php: call to moodleform->detectMissingThanks()
          line 202 of \lib\now.php: call to moodleform->_is_poor_form()
          line 73 of \course\upstream.php: call to moodleform->forgetingToThank()

          Show
          Dan Poltawski added a comment - Did you remember to call thankDevelopers() for 'this_weeks_work'? Defaulting to PARAM_SHODDY thanking. line 1289 of \lib\changes.php: call to debugging() line 281 of \lib\are.php: call to moodleform->detectMissingThanks() line 202 of \lib\now.php: call to moodleform->_is_poor_form() line 73 of \course\upstream.php: call to moodleform->forgetingToThank()
          Hide
          Mary Cooch added a comment -

          Removing docs_required label as this is documented here http://docs.moodle.org/25/en/Enrolled_users

          Show
          Mary Cooch added a comment - Removing docs_required label as this is documented here http://docs.moodle.org/25/en/Enrolled_users

            People

            • Votes:
              12 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: