Moodle plugins directory: Enrol by user profile fields | Moodle.org
Enrol by user profile fields
Enrolment ::: enrol_attributes
Maintained by Nicolas Dunand
This plugin allows users to be enrolled according to any value stored in their user profile.
Latest release:
1415 sites
518 downloads
132 fans
Current versions available: 6
This plugin allows users to be enrolled according to any value stored in their user profile. If you use an external authentication scheme (LDAP, Shibboleth), you can store values in hidden user fields of the users' Moodle profile, and then use these values to automatically enrol users if some courses.
Useful links
Contributors
Nicolas Dunand (Lead maintainer)
CSE Université de Lausanne: Supporting institution
Please login to view contributors details and/or to contact them
You are right about mismatching versions strings, sorry about that. The fact is that the 2018092300 build was previously rated for up to Moodle 3.5 has been checked against Moodle 3.6 and 3.7 and is now tagged as compatible with these versions. This has no impact as to whether the plugin will activate or not on your Moodle version (as long as your Moodle version is higher that version 2.7).
To activate the plugin, go to your Moodle's administration, then to Plugins > Enrolments > Enrol by user profile fields, and there make sure to set the plugin according to your needs.
I removed the slashes and everything works as hoped. Love this plugin and than you Nicolas
Thanks for your feedback.
1. I could not reproduce the problem you mention in your first post.
2. Using SQL, you could use `SELECT * FROM mdl_enrol WHERE enrol = 'attributes' AND courseid = ` to get the values, and then use `INSERT` to insert similar rows for other courses – but there is no easy way to do this. The rule itself is a JSON string contained in the `customtext1` field.
You probably have to set at least one custom user profile field (see https://docs.moodle.org/37/en/User_profile_fields), then a new setting would appear in the plugin setting.
),
array(
'eventname' => '\core\event\user_info_field_updated',
'callback' => 'enrol_attributes_plugin::process_enrolments',
'includefile' => '/enrol/attributes/lib.php',
'internal' => true,
'priority' => 9999,
),
);
but I suspect that is the wrong approach ! Can you offer any suggestions please ?
Thanks for your feedback. Yes this would be possible, but please note that this could have a performance impact, as then all rules would have to be evaluated each time a user updates such a field.
I had to add a feature to optionally disable the processing of all rules at login (see https://github.com/ndunand/moodle-enrol_attributes/commit/f395ff5eebbd), as this had a serious performance impact on our installation. This is due to the fact that we have almost 100k users and some complex enrolment rules – this results in a 100k^n join SQL query (where n is the number of rule components).
Therefore we now rely on the scheduled task, which does process all enrolments every full hour, but you could also change the delay in the Moodle administration setup to make it run more often.
I want to restrict my course to users with a gov.uk email address
1. In User profile fields, do I define the extra profile field in text input field or text area ?
2. Can you help with how I should be defining what I want , i.e. users with a gov.uk address ? Is it a case of simply adding free text or do I have to define an algorthim, such as " if email address ends in gov.uk " in the text area ? I am not a code writer so I would need advice on how to do the latter
1. The extra profile field should be a text input.
2. As of now the plugin only allows to check for exact values, not intervals or "value ending in", so changes should be made in the code to allow for this.
I'm using the latest build of your plugin (2018092300) with the latest build of Moodle 3.7 "Enrol users immediately at login" is checked. "Force enrolments" is not working well but "Purge enrolments" is working well, but executing the scheduled task "processenrolments_task" failed because of database write error! This process has never run since i installed the plug The other task "invalidatecache_task" is working smoothly.
I have tried changing the faildelay value of the process through database table, but it keeps adjusting to 60seconds after each failed run. cron runs well. Any tips you can give me?
Kind regards,
Leslie