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:
1311 sites
222 downloads
120 fans
Current versions available: 4
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)
RISET Université de Lausanne: Supporting institution
Please login to view contributors details and/or to contact them
Please ensure the following :
1.- In Site Administration > Users > Accounts > User profile fields, here are the user profile fields that can be used by the plugin.
2.- In Site Administration > Plugins > Enrolments > Enrol by user profile fields : the default role should be set and in the "Profile fields to be used in the selector" the user profile fields you want to use with the plugin have to be selected, then save the options.
3.- In that same screen, leave the Shibboleth Mappings field empty.
4.- In a test course, go into Course Administration > Users > Enrolment methods and create a new "Enrol by user profile fields method" : optionally give it a name and – that's mandatory – a rule set, it can be one simple rule or a set of rules.
Users are then enrolled when they next login, or when you click the "Force..." button within the enrolment instance settings.
Just note that if any user is already enrolled in the course (i.e. by another enrolment method), that user is skipped by the plugin.
I set up everything exactly like you described in your manual above. Unfortunately it does not enrol any of my test user. I tested it with Moodle 2.8 and Moodle 2.9.2. If I run cron manually I see the following error
Running cron for enrol_attributes...
... used 3 dbqueries
... used 0.018087148666382 seconds
Scheduled task failed: Legacy cron processing for plugins,Error reading from database
Any ideas why it won't work?
Many thanks!
--------------------------------------------------------------------
stdClass Object
(
[rules] => Array
(
[0] => stdClass Object
(
[param] => Key
[value] => ABC
)
)
)
line 95 of /enrol/attributes/edit.php: call to debugging()
Array
(
[select] =>
[where] =>
)
line 97 of /enrol/attributes/edit.php: call to debugging()
SELECT DISTINCT u.id FROM mdl_user u WHERE
line 99 of /enrol/attributes/edit.php: call to debugging()
Error reading from database
More information about this error
Debug info: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
SELECT DISTINCT u.id FROM mdl_user u WHERE
[array (
)]
Error code: dmlreadexception
Stack trace:
line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 1080 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 100 of /enrol/attributes/edit.php: call to mysqli_native_moodle_database->get_records_sql()
------------------------------------------
Any ideas?
I have some custom profile field in moodle and when i am adding this enrolment plugin in moodle and setting rules to automate user enrollment in course and when user matching the criteria could not enrolled and also when I am clicking force enrollment button but still it is not working.
This is a known problem that I'm currently fixing. If you're confortable using a pre-release version of the plugin, you can try out the latest release available on GitHub (see the "Source control URL link near the top of this page). If not, I should release an official new version of this plugin within a couple days.
I've just released a new version of this plugin, which addresses all known problems. It is available immediately, and also officially supports Moodle 3.0.
Thanks to all who reported bugs, and especially to Martin from Canada and Kathrin from Germany, who wen to great lengths to provide details of their debugging sessions.
Yes, I would like to add this in the future. I've added this as a feature request (see https://github.com/ndunand/moodle-enrol_attributes/issues ).
In the meantime if anyone is willing to work on this feature I'd be glad to include it.
Thankyou Nicolas for releasing this plugin once again and fixing issues. You have done really a goodjob by making this plugin.
Once again thankyou
Sudhanshu
Nicolas, great work here thank you! It's plugins like this that add basic functionality yet drastically improve efficiency that I enjoy using. No duration/expiration feature aside, still an excellent plugin.
Could this functionality be extended to work with group enrolment keys also?
Or what about some method to assign a role to a category, such as listing them along with the role in relation to a defined custom profile field?
Thanks for this plug-in, I am struggling to get it to work however
When I installed and ran an enrolment instance I got a database access error as it was looking for the wrong user name field trying for mdl_user, whereas my db prefix is nmdo.
So I changed line 102 in the attributes/edit.php (changing 'SELECT DISTINCT u.id FROM mdl_user u ' to 'SELECT DISTINCT u.id FROM nmdo_user u ' )
The error has gone but the plug-in still will not work, I am trying to enrol based on a drop down profile field value.
Any ideas or suggestions to investigate much appreciated.
Thanks
Roger