Friday, February 26, 2016

Extracting user list filtered by enrolment method in a Moodle course

Imagine you want to invite two sets of people to enrol in a Moodle course. You want to place different limits on the enrolment numbers for each set. You can't use Moodle Groups in this case as it doesn't allow group-level enrolment caps (at least not in version 2.6). You can only place enrolment caps at the level of a self-enrolment method. So you'll have to create a self-enrolment method for each set of people. That's easy, but what if you want to extract users who joined the course using each method and perhaps do further analysis? It's easy to see these lists using the filters available in Users -> Enrolled users, but you can't download them (at least not in Moodle 2.6, which I use).

This is what you can do:
  1. Filter the required list of users in Users -> Enrolled users using the "Enrolment methods" filter.
  2. Hide all blocks on this page.
  3. Copy everything on this page using Control + A (on Windows). Yes, copy everything - all the stuff you need and all the messy surroundings. Quicker this way.
  4. Paste everything into Notepad or another text editor (not Word).
  5. Copy the Notepad stuff and paste into an Excel sheet. Now you should see a lot of stuff all in one column - don't worry about the mess. Just make sure it's all in one column.
  6. In the adjacent column, put this formula to extract all the email addresses and ignore cells that don't have an email address: =IF(ISERROR(FIND("@",A1,1))=TRUE,"",A1)
  7. Pull the formula down to occupy all the cells corresponding to column A. You'll then have a cleaner column with only emails but a lot of empty cells too. Copy all this and put into another sheet. Remove the duplicates (in Excel, Data -> Remove duplicates). And you should have a clean list of only email addresses.
  8. Repeat the above process for every page of enrolled participants (I see 100 people per page on my Moodle for step 1 - I'm not sure if this setting can be changed).
  9. Repeat the above process for different enrolment methods.
  10. You probably want more than just email addresses of the participants. Use the gradebook or activity completion report in your course to get a list of all users, add a column in that sheet to put in the enrolment method of each participant, paste the emails from steps 7 and 8 into a sub-sheet, and do a VLOOKUP.

No comments:

Post a Comment