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:
1337 sites
240 downloads
118 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.

Screenshots

Screenshot #0

Contributors

Nicolas Dunand (Lead maintainer)
RISET Université de Lausanne: Supporting institution
Please login to view contributors details and/or to contact them

Comments RSS

Comments

  • Thu, Jun 23, 2016, 12:54 AM
    Peter Ward, your follow-up notes helped me with an issue I was having! Thank you!
  • Mon, Jul 11, 2016, 8:49 PM
    Hi Peter,

    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
  • Mon, Jul 11, 2016, 8:50 PM
    Hi Joao Pedro,

    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.
  • Mon, Jul 11, 2016, 8:51 PM
    Hi Melissa,

    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
  • Wed, Jul 13, 2016, 12:26 PM
    Hi. Am running Moodle 2.8. Installed the plugin without any problems and it's showing as available (eye open) in the enrolments plugins however it is not present in any courses' drop down box for adding it as an enrolment method. Any suggestions or help would be appreciated
  • Wed, Jul 13, 2016, 12:58 PM
    Hi Narissa,

    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.
  • Fri, Jul 15, 2016, 7:22 AM
    Hi Nicolas
    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:
  • Fri, Jul 15, 2016, 2:41 PM
    Hi Narissa,

    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.
  • Fri, Jul 22, 2016, 8:07 PM
    Hi Nicolas,
    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
  • Wazza
    Fri, Jul 22, 2016, 10:21 PM
    Any time until Moodle 3.1 support?
  • Mon, Jul 25, 2016, 1:38 PM
    Hi 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.
  • Mon, Jul 25, 2016, 1:48 PM
    Hi Richard,

    Official Moodle 3.1 support is available as of now.
  • Tue, Jul 26, 2016, 12:06 AM
    Thanks Nicolas.

    also with regards b) what is the name of the cron job that runs?

    Cheers

    Peter
  • Thu, Aug 4, 2016, 3:40 AM
    Dear Nicolas,

    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
  • Thu, Aug 4, 2016, 4:21 AM
    just one think to add: when I hit the force enrollment button an ajax window pops up stating this will (re)enroll all users corresponding to this rule. I push OK and nothing happens. When I hit the "purge enrollments" just to test same pop up comes and when I push the ok few sec later an other pop up comes stating, "ok, enrollments are purged". Hope this help to solve the issue.
    thanks in advance
Please login to post comments