Moodle Plugins directory: Automatic enrolment in groups | Moodle.org

Automatic enrolment in groups
In brief, groupautoenrol randomly assigns students to course groups when they are enrolled in a course (via any enrollment method: auto-enrol by key, cohort sync, or manual enrolment).
- Author: Pascal M, https://github.com/pascal-my
- Author: Luuk Verhoeven LdesignMedia
- Author: Gemma Lesterhuis LTNC B.V.
- Min. required: Moodle 3.9
- Supports PHP: 7.4
- Automatically enrolls students into groups when they join a course
- Works with all enrollment methods (manual, self-enrollment, cohort sync)
- Random assignment to ensure balanced group distribution
- Per-course configuration
- Uses
\core\event\user_enrolment_created
(user_enrolled) Moodle event - Safely handles deleted groups (ignores them during assignment)
- GDPR compliant implementation
- Admin tool plugin architecture for better integration
- Enable/disable plugin per course
- Choose to auto-enrol in all existing groups or specific ones
- Course-level management through "Course administration > Users > Auto-enrol in groups"
- Copy this plugin to the
admin/tool/groupautoenrol
folder on the server - Login as administrator
- Go to Site Administrator > Notification
- Install the plugin
- Create groups in your course(s)
- Enable the plugin for specific courses via "Course administration > Users > Auto-enrol in groups"
Note: The "Auto-enrol in groups" link appears even if the plugin is not enabled for the course.
- Create test groups: Navigate to a course and create multiple groups via Course administration > Participants > Groups
- Enable auto-enrollment: Go to Course administration > Users > Auto-enrol in groups and enable the feature
- Test enrollment methods:
- Manual enrollment: Add users manually and verify group assignment
- Self-enrollment: Have users self-enroll using an enrollment key
- Cohort sync: Add users via cohort synchronization
- Verify results: Check Course administration > Participants > Groups to confirm users were randomly assigned
- Tested with Moodle 3.9 - 5.0
- PHP 7.4, 8.0, 8.1 support
- Previous versions available for older Moodle releases
- 5.0.0: Added support for Moodle 5.0
- 4.5.0: Moodle 4.5 & PHP 8.1 version (stable release, June 2024)
- 4.4.0: Moodle 4.4 version
- 4.3.0: Moodle 4.3 version
- 4.2.1: Fix issue #2 - Increased size of groupslist column
- 4.2.0: Moodle 4.2 & PHP 8.0/8.1 version
- 3.9.0: Moodle 3.9 & PHP 7.2 | Moodle 4.0 & PHP 7.4 | Moodle 4.1 & PHP 8.0
- 1.1.2: Stable version as admin tool plugin for Moodle 3.x
- 1.1.1: Stable version as local plugin for Moodle 2.x ( see moodle-local_groupautoenrol)
- 1.1: Initial stable version (had bugs)
- GDPR implementation
- Per-course enable/disable option
- Choice to auto-enrol in all existing groups or specific ones
This plugin is carefully developed and thoroughly tested, but bugs and problems can always appear. If you discover any security related issues, please email support@ldesignmedia.nl instead of using the issue tracker.
Please bear in mind that bug and problem support is not free of charge. This is with the exception of developers that report and suggest a solution by creating a pull request.
We are aware that members of the community will have other needs and would love to see them solved by this plugin. We are always interested to read about your feature proposals or even get a pull request from you, but please understand that we handle these as feature proposals and not as feature requests that we commit to implementing.
Group Auto Enrol code is provided freely as open source software, under version 3 of the GNU General Public License.
Contributions are welcome and will be fully credited. We accept contributions via Pull Requests on GitHub.
- @copyright 2016 Pascal
- @author Pascal M - https://github.com/pascal-my
- @author LTNC - https://ltnc.nl
- @author Luuk Verhoeven - https://github.com/luukverhoeven
Thanks.
I never used external database, so I am not planning to work on enrollment automatically from external database for now, sorry. You can improve my code in this way
I need students to be assigned to specific groups, and I have a table in an external database that contains the groups and students names. Can you tell me how this plugin assigns groups, so that I can augment for my use?
Note : I have no idea if my plugin still works with Moodle > 3.0.
You have to test it first !
No problem for updating this plugin, I have not time to update it anymore. I sent you a "contact request".