Using cohorts with Moodle 2.2

Cohorts are very useful in Moodle 2, but with the upcoming Moodle 2.2 release – cohorts become much more useful. It is not that the enrolment options have changed, so what has?

Up until now, the only way to add users to a cohort was through the user interface manually assigning them, which although it worked was quite time consuming! With the upcoming release this has been improved with the changes to the user upload.

The existing upload users options enables to you do a range of things including:

  • create user accounts
  • update user accounts
  • add users to a course or many courses
  • specify which role that the user is added to each course
  • specify which group that the user is added to in each course

But with Moodle 2.2 you will be able to add the user to an existing cohort!

Currently if you had year1 with four Moodle courses, and you wanted to mass upload users you would have a csv (spreadsheet) which had four courses specified.

So you would have the fields

  • username
  • password
  • firstname
  • lastname
  • email
  • course1
  • course2
  • course3
  • course4

And for each of the course1 fields you would specify the shortname of the course involved (mathsyr1, or whatever you use).

However with Moodle2, if you have enroled a cohort called year1 into each of those courses, now all you need to do is add the user to the cohort and they will be automatically added to each course under that cohort.

So now the csv has less fields and is easier to follow

  • username
  • password
  • firstname
  • lastname
  • email
  • cohort1

An example being:

username,password,firstname,lastname,email, cohort1
tomjones,Pass1234*,Tom,Jones,, year1
marysmith,Pass1234*,Mary,Smith,, year1
bobjones,Pass1234*,Bob,Jones,, year2
alicesmith,Pass1234*,Alice,Smith,, year2

This is going to make using cohorts much easier, and although it is a small change it is really a huge one. The one thing to remember is that you MUST have the cohort already created.

So the process is as follows:

Firstly you would define all the cohorts in the cohort management area. This is found under  Settings -> Site administration -> Users -> Accounts -> Cohorts.

Setting up the cohorts

Setting up the cohorts

Secondly you would enrol the cohort into each of the courses that it would cover. Once within the course, you find it in the course administration section under Settings -> Course administration -> Users -> Enrolment methods

Course Enrolment Methods

Course Enrolment Methods

Once you have linked the cohort into all of the courses that you need to, you are ready to upload your users. As above, there is an example format of the csv. You upload it through the Upload users feature which is found under  Settings -> Site administration -> Users -> Accounts -> Upload users.  You select the file which your want to use and click Upload users.

You are then show a preview of the upload file (and it checks if the format is correct).

user upload preview

user upload preview

Once you have selected the other options on the page and chosen your default values you then click on Upload users. This processes your file fully, and creates the users and adds them to the correct cohort.

upload users complete

upload users complete

So what has happened?

The users are now synched to all the courses that the cohort was attached to. Checking the cohort page again, we see that two users have been added to each of the cohorts which is exactly what we wanted.

Cohort list updated

Cohort list updated


So now we can check the course, and here is the view of the enrolled users in one of the courses:

course user list updated with cohort members

course user list updated with cohort members

So it shows that the users are now enrolled, as students, and that it is part of the cohort.

So that is it, it will be in Moodle 2.2 once it is released.

Spreadsheets at the ready!

Creative Commons Licence
This work by Gavin Henrick is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

This entry was posted in Moodle and tagged , , , , . Bookmark the permalink.

13 Responses to Using cohorts with Moodle 2.2

  1. Pingback: Using cohorts with Moodle 2.2 « Gisele Brugger – Consultoria em sistemas LMS

  2. pat madea says:

    Mr. Henrick…

    Is there a way to disconnect users from cohorts? We are using moodle 2.2, upgrading from 1.9, and someone enrolled hundreds of users using cohorts and now, when the users log in, they see 20 modules they have been wrongly enrolled in… Is there a way to undo all this?



    • ghenrick says:

      The admin can remove people from a cohort which will remove them from where the cohort is enrolled, if they used cohort synch enrol method.

  3. Steve says:

    I’d like it if users from different cohorts were automatically put into different groups in the courses they are enrolled in.

  4. Tanya Kingdon says:

    Hi Gavin,

    I have a problem with these cohorts that maybe you can help me with. I have followed the tutorials, made up the cohorts, made sure the plugin is enable, and enrolled the cohorts in a course. The problem is, the students are given the student role but it’s not active, ie you don’t have that little “no entry sign” (that’s what it looks like to me) so when the students go into the course, they can get in, but when they try to go into the forum we want them to use, they are completely kicked out of the course. Looking at your screenshot above, I notice that you don’t have this little no entry sign either, so are you sure it works?

    Any ideas what I might be doing wrong?

    Tanya Kingdon

    • ghenrick says:

      What version of Moodle are you using?

      I was only just using cohorts for student enrolment this week in a training session, which worked fine.

      • Tanya Kingdon says:

        We are using 2.2, but actually in the meantime we have solved the problem. When you go to enrol the cohorts, there are two buttons you can push, “enrol cohorts’ and right next to it ‘enrol users’ and we were clicking on ‘enrol cohorts’, which just puts the names in, but doesn’t activate the role, once we used enrol users, it worked perfectly, so thanks anyway.


  5. Carol Howells says:

    I am using 2.2. Do you know if you can add a delete field to the upload users file so that you can bulk delete from a cohort? Thanks

  6. armin says:

    Hi. Is there a way to view grades of one cohort? is enrollment the only purpose for the cohorts? Thanks.

    • ghenrick says:

      Yes, cohorts are just for enrolment.

      But if you automatically put a cohort into a group in the course, then u can filter for that group on gradebook.

  7. Lucila Romeo says:

    Is there any way of enroling a cohort in different courses via csv file?


  8. Ok, I am able to enroll people in a course using cohort. But how can I promote a cohort to become a group inside that course?

    Regards, ger

  9. To complete my previous question: plugins like the block Quickmail do not see cohorts as separate groups.

Comments are closed.