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
540 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
Sorry I was away for a few weeks. Thanks for your feedback.
Actually, the HTML editor does have this drawback. The solution for such fields is to use a field of type "text input" instead of "text area". I actually didn't think of the case when people would use a text area to store these values.
The enrollments are processes as follows:
a.) When a user logs in, all rules are check to see whether any apply. If so, the user is enrolled in any relevant courses before arriving on the landing page.
b.) There is a cron job running every 6 hours (because this is heavier lifting) to check for all rules, enrolling any users that need to be enrolled.
Cheers,
Nicolas
From our testing, the current version fully supports Moodle 3.1. I'll release an update in the coming weeks, providing official Moodle 3.1 support.
Sorry for being too late to help, and glad that Peter could help. Could you please write down a couple lines here to help me locate the issue, so that I could improve the plugin ? It could also be beneficial to other users that could be stuck with the same issue.
Thanks,
Nicolas
To activate the plugin you have to check its settings (in the Administration block -> Site Administration -> Plugins -> Enrolments) and make sure at least one field is selected.
I'm not sure if I'm having a dense moment but I'm assuming you're referring to Site admin > plugins > enrolments > Enrol by user profile or did you mean something else?
This is all I get on that page:
I see. This is likely because this plugin only works with additional profile fields – so the only fields you could select here would be some of these. To define additional profile fields, go to Site admin > Users > Accounts > User profile fields.
I need to check something with you that you answered for me previously.
You said.....
The enrollments are processes as follows:
a.) When a user logs in, all rules are check to see whether any apply. If so, the user is enrolled in any relevant courses before arriving on the landing page.
b.) There is a cron job running every 6 hours (because this is heavier lifting) to check for all rules, enrolling any users that need to be enrolled.
So I have now.....
Just applied your plugin to a moodle v3.1 and configured it just as I did in moodle v3.0
My tables are prefixed mood_ and not mdl_ so I changed your edit.php file to match
But my user isn't logged in as per a) above. Maybe there are other references to mdl_ I need to change, please advise
also with regards b) what is the name of the cron job that runs?
Many thanks in advance.
Peter
There are a couple spots in edit.php, but that's the only file that needs patching. The upcoming release addresses this issue, and you won't have to patch it anymore.
The cron function is in lib.php.
Official Moodle 3.1 support is available as of now.
also with regards b) what is the name of the cron job that runs?
Cheers
Peter
I added and set up the plugin (latest version), and have an issue. As you can see from your debug message your plugin finds two cases when the the enrolment should happen:
sqlquery= SELECT DISTINCT u.id FROM mdl3_user u RIGHT JOIN mdl3_user_info_data d1 ON d1.userid = u.id WHERE (d1.fieldid = 4 AND ( d1.data = 'aaaaa' OR d1.data LIKE '%;aaaaa' OR d1.data LIKE 'aaaaa;%' OR d1.data LIKE '%;aaaaa;%' ))
line 102 of \enrol\attributes\edit.php: call to debugging()
countusers= 2
line 104 of \enrol\attributes\edit.php: call to debugging()
However when I push the force enrollment button nothing happens, even when a user log in no enrolment is happening. When the loged in user wants to enroll manualy Moodle says: you can not enrol yourself ... which is right as your plugin is the only one added to the course.
Please help what is going wrong.
thanks,
András
thanks in advance