Skip to main content

Restricting a Course Using Enrollment Keys

By default, the self-enrollment method allows anyone to enroll themselves in courses. A course enrollment key (a.k.a. a password) is one method of restricting self-enrolment to a smaller group. The idea is that one or more people will supply the course key to authorized people. Sometimes, this distribution is a private email, on the phone or even verbally. 

Step-by-step Guide

To set an enrollment key in a course:

  1. Go to the course in question
  2. Go to Course Administration > Users > Enrolment methods
  3. Make sure the "Self enrolment" method is visible (with the eye icon open)
    1. If the eye icon is closed, click on it to make the method available
    2. If the method is not visible at all, add it by clicking on the pulldown menu next to the "Add method" label
    3. If the method does not appear, it's because you do not have the ability to enable self-enrollment in the course
  4. Click on the edit icon (cog wheel) next to the self enrollment method
  5. Set an enrolment key in the "Enrolment key" field
  6. Click on the "Save changes" button


Using Multiple Keys

It is possible to add multiple instances of the self-enrollment method to any course. However, you should restrict each instance to specific cohorts using the "Only cohort members" field in the self-enrollment method settings. Otherwise, when a user tries to enroll in a course, they will see multiple boxes asking them to enter their key and not only will they need to know the key, they will also need to know which box to enter it in.  This can easily become a usability issue, not to mention that a screen with multiple "Enrol me" buttons is not visually pleasing.

If there is no way for you to place users in cohorts and you can't restrict the visibility of the self-enrollment method, we recommend that you use group enrollment keys instead.

When group enrollment keys are used, the self-enrollment allows you to enroll students into the course and also directly into groups.  To do this, you first need to add the course enrolment key as in the section above. If you do not set a master course enrolment key for the course, then anyone can enroll without a key and users will not be put into groups. Then:

  1. Click on the edit icon (cog wheel) next to the self enrollment method
  2. Set "Use group enrollment keys" to "Yes"
  3. Click on the "Save changes" button
  4. Go to Course Administration > Users Groups
  5. Click on the "Create Group" button
  6. Fill out the form, ensuring that you set a unique "Enrolment key" for each group that you create
  7. Click on the "Save changes button

Important Notes

  • Users in groups do not need to know the master course enrolment key, only their own group enrolment key.
  • Users not in a group can use the master course enrolment key as usual
  • The group enrollment keys must adhere to the password policies set in the system



Dual Code Administrator: Alternatively, a Keyholder role may be created and assigned, then the text 'You should have received this enrolment key from...' will be displayed when a student attempts to enrol. See https://docs.moodle.org/39/en/Keyholder_role for more details. We don't have this role yet but are considering adding it in a future release.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.