Enrolment ::: enrol_autoenrol
Maintained by Mark Ward, RobertoRoberto Pinna
Adds functionality to automatically enrol users onto a course, either as they log in to your Moodle site or as they access a course. This plugin was at first intended for use on courses which you want all users to be able to access but can also be configured for more advanced purposes as reserved access courses. Using the new user filtering you can think at Autoenrol as a Swiss Army knife for Moodle enrolments.
Latest release:
4560 sites
166 fans
Current versions available: 3

When added to a course this enrolment plugin can enrol users onto a course automatically, either as they log in to your Moodle site or as they access to the course.
It was at first intended for use on site-wide courses such as "Moodle Help" or "Learner Voice".
In addition the plugin has advanced functionality to support automatically grouping and filtering users based upon their profile fields. Depending on how your user accounts are setup this may help you to give access to certain user groups.

Configuration of the plugin is managed by two capabilities which allow administrators to easily control who has access to the plugin.

New advanced user filtering (available from 2.3)
A complete rewrite of Autoenrol filter that use moodle standard availability interface adds great flexibility in user filtering.
The Moodle availability plugin for user profile fields unfortunately does not include language and authentication. 
If you need them, you can install additional availability plugins like Restriction by language and Restriction by authentication.


Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3
Screenshot #4
Screenshot #5
Screenshot #6


Mark Ward (Lead maintainer)
Roberto Pinna: Maintainer
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Roberto
    Thu, Feb 23, 2023, 4:03 PM
    Hello Nick,
    the AutoEnrol filter use Moodle availability plugins, the same you can use to limit access to activities so your answer is: yes, you can do.
    1. If you want, you can add one by one rules for all the usernames;
    2. more easely you can add a filter rule that check profile field username that start with "20" to match 20smithj and any other student that has joined in 2020).

    1bis. You can also add availability plugins that match your needs.
    I developed an availability plugin that get an excel file with the list of users that could be allowed or denied (


  • Nick Varney
    Thu, Feb 23, 2023, 10:29 PM
    Hi Roberto

    Thanks so much.

    The esse3enrols availability plugin looks interesting.

    1. When combined with 'AutoEnrol' can it auto-enrol users to every course that uses it as soon as they login to Moodle? Or do they need to click on each course to enrol?

    2. Could you provide an example of the Excel format? I have seen the instruction 'a custom Excel file with a column header that match with the Moodle admin selected field name.' but I'm not sure what that means.

  • Roberto
    Fri, Feb 24, 2023, 12:51 AM
    Hi Nick,
    you can set AutoEnrol to enrol users on login or when they click on each course, availability plugins are used to check if they can be enrolled .
    Please be aware if you set autoenrol on login in several courses and your site has a lot of logins each day. This could slowdown your site performances.

    If you use username as profile field in Esse3enrols and your user language is english, you can write something like this in your Excel file:

    The column header is the translation in the uploader user language of the field name.

  • Nick Varney
    Fri, Feb 24, 2023, 6:28 PM
    Many thanks Roberto, that's worked perfectly in testing. What a great set of plugins!
  • Aniket Khaire
    Mon, Apr 3, 2023, 5:31 PM

    I have 5 different Courses. and after completing all of them "Course Complete" should get a check.
    And it was working fine but since last few days its not working.

    Earlier it was set that students will get access to 3-4-5 only when they complete 1 and 2. Auto access to 3-4-5 was not allowed. But then recently that was changed and set to all courses will be given to student at once.

    Now the issue I am facing is, student have completed 1-2-3-4 yet there are no check box checked in front of their names in Course 5, being more specific, sometimes, some of them are checked and sometimes none of them. Check box are checked in each Courses (Lets say, a student enrolled for all, and have completed 1 to 4 and in each course report it is showing that they have completed this course and shows checked box but in 5th course it doesn't show check box checked.) Because of this no student is able to get a certificate. Can you help?
  • Steve Zielinski
    Wed, Apr 5, 2023, 7:22 AM
    Putting this problem and solution here for others ...

    The Auto Enrol plugin must be enabled after installation.

    Go to
    Site administration -> Plugins -> Plugins overview

    The plugins are grouped under various headings/types.

    Find the Enrolment methods heading.

    Next to that heading will be a gear icon.

    Click the gear icon.

    You will see a list of Available course enrolment plugins.

    The Auto Enrol row will be greyed out.

    Click the "eye" icon to Enable the plugin.

    Now, go to your Course.

    Click the gear icon dropdown. (In 3.9 it is above the "Turn editing on" button.

    Choose "More ..."

    Choose the "Users" tab.

    Click "Enrolment methods" (the heading in the left column).

    In the dropdown next to "Add" select Auto Enrol.

  • Александр Гнедов
    Thu, Jul 13, 2023, 4:11 PM
    Thanks for such a cool plugin.
    Tell me, please, how can I add the "position" field in the application, because when choosing fields, it is not there and is most likely not available on the platform either.
    It turns out that you first need to add this field through the administration panel so that timing data is recorded there? And then it is already expected in the course auto-assignment add-on?
  • Roberto
    Fri, Jul 14, 2023, 6:01 PM
    I'm sorry but I didn't find any reference to a "position" field in Moodle.
    The user database table does not include it, and if you don't have a user profile custom field called position I don't think you can manage it without an additional availability plugin.

    I suggest to you to search for an availability plugin that check the "position" field in order to use it with autoenrol.

  • Александр Гнедов
    Mon, Aug 7, 2023, 6:40 PM
    Roberto, thanks.

    Can you tell me more about the accessibility plugin.

    I have LDAP connected on Moodle, and all employees have a position field. I created a custom field "position", but I don't know how to automatically pull it into this field, maybe you know how to do it?
  • Roberto
    Mon, Aug 7, 2023, 7:10 PM
    if you have created a custom field for "position", you just need to map it from your LDAP connection.
    You can look at for details.
    If users position change time by time I suggest to update local on login so each time the user login Moodle gets data from LDAP.

    After that you can add a user filter with the custom filed to Autoenrol with without any other availability plugin.

  • Александр Гнедов
    Tue, Oct 24, 2023, 4:57 PM
    Hello. Is it possible to create an assignment condition using the "date" format? So that, for example, a course is assigned to a student only after a certain date. For example, a student entered on October 23 and from October 24 he will be assigned one course or another. I saw there is a "starts" condition, but it doesn't fit, right?
  • Roberto
    Wed, Oct 25, 2023, 9:04 PM
    Hello, did you mean a way to add a delay to student enrolment?
    I try to enrol today but I will enrolled from tomorrow.
    You can't do that with autoenrol, you need an other enrolment plugin to do that.
    I don't know if someone has already developed something like that but it could be done so if not you can develop it by yourself.

  • Александр Гнедов
    Fri, Oct 27, 2023, 6:52 PM
    Roberto, I meant, is it possible to set the restrictions for automatic enrollment on a certain user field so that a student who came a year ago is not automatically enrolled in the course, but a student who came yesterday is automatically enrolled. For this purpose, I created my own field - “Date of admission to school”. As I understand it, you can’t do this using conditions, right?
  • Roberto
    Mon, Oct 30, 2023, 3:22 PM
    you can use custom field with auto enrol but profile field availability plugin does not support date custom fields.
    I submitted an issue in Moodle Tracker (MDL-72083) a couple of years ago but it still opened.
    You can vote for it in order to promote the development.

  • Yogesh Kumar
    Sun, Nov 12, 2023, 3:24 PM
    The following option throws a DB error for users complaining about the duplicates in DB after the first login.
    User Filtering --> Group By (User Filter) --> Group Name (some value)

    It should not try to make an entry to the group every time the user logs in.

    Error Message:
    [Sun Nov 12 03:32:37.028814 2023] [php:notice] [pid 3214911] [client] Default exception handler: Error writing to database Debug: Duplicate entry '3-618' for key 'm_groumemb_usegro_uix'\nINSERT INTO m_groups_members (groupid,userid,timeadded,component,itemid) VALUES(?,?,?,?,?)\n[array (\n 0 => '618',\n 1 => '3',\n 2 => 1699759957,\n 3 => '',\n 4 => 0,\n)]\nError code: dmlwriteexception\n* line 497 of /lib/dml/moodle_database.php: dml_write_exception th
Please login to post comments