Enrol Profile Field - Enrolment on profile field: Use case
Example on a profile field
An LDAP profile field feeds the user identifiers coded in their profile on Moodle.
Structure of a 7-digit student code (ID number):
- 1st digit: campus code,
- next 2 digits: year of enrolment at the school,
- next 2 digits: programme code
- last 2 digits: student increment
Goal: automatically enrol users in course X according to programme code 40 to 45.
Solution:
- Display the users' identifier (site admin/site security rules) to check the rule runs correctly
- Use regular expressions for the rule (REGEXP) in the profile field enrolment method
- check by logging in with a student whose identifier matches the rule
Example of the expression to use, written without spaces:
REGEXP:^[0-9]{3}(40|41|42|43[44|45)
or equivalent:
REGEXP:^[0-9][0-9][0-9](40|41|42|43[44|45)
Here we start after the 3rd character, i.e. after the digits that correspond to the year of enrolment at the school, and we enrol the students for whom 40 to 45 is found in the student code.
Careful: it is important to place the rule on a non-ambiguous element
Example: In case of different ID lengths, for example for different users, and by invoking two enrolment methods in the course with different regular expressions, you will have to check for non-collisions.
Back to the component index - Back to catalogue - Back to plugins index - Index of plugins on enrolment methods
