This Authentication plugin automatically enrol users into cohorts.
Cohort name depends on user profile field.
How to use:
- Copy plugin into /moodle/auth directory
- Go to Site administration - Notifications page and install it
- Go to Plugins - Authentication and enable plugin
- Configure main rules (template for cohort name)
second rule (replace empty field)
and replacement array
- Enable unenrol option
Cohorts are created in CONTEXT_SYSTEM
See README.md for details
You have a custom profile fields "status" (student, teacher or admin) and "course".
You wnat to enrol many users into cohorts like "course - status" than enrol cohorts into courses.
At configuration page set:
Main template to %profile_field_course - %profile_field_status
Empty field text (When field is empty this value used) to none
When 1st course student logins, he enrol to cohort named "1 - student"
When 1st course teacher logins, he enrol to cohort named "1 - teacher"
When admin logins, he enrol to cohort named "none - admin" (Course not set, status - admin)
To rename "none - admin" cohort to "Administration" you must set a replacement array field at the configuration page (1 replacement per line, old_value|new_value)
In our case: none - admin|Administrator
When admin logins, he enrol to cohort named "Administrator"