Your Moodle version

Enrolment: Enrol by user profile fields

Maintained by Picture of Nicolas Dunand Nicolas Dunand
This plugin allows users to be enrolled according to any value stored in their user profile.

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.




Picture of Nicolas Dunand
Nicolas Dunand (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Ferry van der Vorst
    Thu, Sep 5, 2013, 8:44 PM
    Hi Nicholas,

    Is there any indication when the plugin will be available for version 2.5 of Moodle? Will the 2.4 version work OK on 2.5 also?

    Many thanks.
  • Picture of Nicolas Dunand
    Tue, Sep 10, 2013, 1:29 PM
    Hi Ferry,
    The latest version has been tested and is working on Moodle 2.5. It is available on GitHub (check the "Source control URL" link above) and should also be available here directly shortly.
  • Picture of Ferry van der Vorst
    Wed, Sep 11, 2013, 6:35 PM
    Hi. Nicolas,

    Thanks for your help so far. Much appreciated.

    Sorry. Have another question/other questions.

    I am new to this plugin and was wondering if you have documentation or an example of how to map Moodle custom fields and modify the dropdowns. I am trying to get my head around mapping fields to labels for the plugin.

    For instance, Is there a way of mapping Moodle Profile Fields or Custom Profile Fields through the admin interface of Moodle, or does this need to set in the jquery.booleanEditor.js? Same with the dropdown labels.

    The admin screen example seems to map Shibboleth fields to mappings defined in the JavaScript file.

    I am able to modify these through the JavaScript file, but what would be the impact when upgrading?

    For instance, if I have a custom field, called test (profile_field_test) and want to use a label 'Testing', which should appear in the dropdown also. Do I need to add in the Admin screen the following?


    In lib.php. the "profile_field_" value prefix is added as standard (which I assume is the reason why only custom fields are allowed). Will removing this allow me to use standard Moodle fields also? Or is there another option to allow for enrolments based standard fields? For instance, enrol a user based on the Language list (e.g. mapping a Language label to the lang value to enable enrolment for language specific versions. Similar to country specific versions, for instance?

    Many thanks in advance.
  • Picture of Jared Annis
    Thu, Sep 19, 2013, 7:20 AM
    Noob here, is there any documentation for this plugin?
  • Picture of Rob Rashotte
    Sat, Sep 21, 2013, 3:21 AM
    I am trying out this module on a test site and am having problems for the profile fields. Where are the custom profile fields pulled from. I see the sample profile fields from your screenshot in my dropdown list, but these are not defined user profile fields on my test system. I have also created 2 custom profile fields, but they do not show up in the drop down.
  • Picture of Seyit Kaya
    Fri, Sep 27, 2013, 3:57 PM
    Hi. i installed this plugin but anything happened. i can see under Enrolment/Enrol By user Profile Fields and when i click this i see this on screen

    Default Role ..............
    Mappings ........
    List of Values (one per line), e.g:.

    what is the problem?
  • Picture of Carlos Rubalcava
    Thu, Oct 17, 2013, 12:44 AM
    At what point does this plugin do the enrolment? Signup/login/course access?

    What happens if an employee gets a raise and has to take a manger position course but he was enrolled to the employee position course. Will the plugin notice the profile_field_position change and enrol to the courses that are required of the new position
  • Picture of Lael ...
    Wed, Feb 12, 2014, 1:35 PM
    ok - looks like the options for the enrolment fields need to be hardcoded into: jquery.booleanEditor.js lines 14 -19 or so, delete as needed. Haven't got it working yet - but that seems to be the first step.
  • On the jetty
    Thu, Feb 27, 2014, 11:56 PM
    Hi - does this work for Moodle 2.6?
  • Picture of Nicolas Dunand
    Fri, Feb 28, 2014, 4:06 PM
    afaik this *should* work on Moodle 2.6 but I haven't checked it yet – I'll make sure it works for Moodle 2.7 this summer as we'll upgrade our platform
  • Picture of Lael ...
    Thu, Jun 26, 2014, 9:15 AM
    We just upgraded our DB to mysql5.6 and are now getting this error:

    [26-Jun-2014 10:32:07 Australia/Sydney] Default exception handler: Error reading from database Debug: 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 FROM mdl_user u WHERE 1 AND u.deleted=0 AND
    [array (
    Error code: dmlreadexception
    * line 443 of \lib\dml\moodle_database.php: dml_read_exception thrown
    * line 996 of \lib\dml\mysqli_native_moodle_database.php: call to moodle_database->query_end()
    * line 229 of \enrol\attributes\lib.php: call to mysqli_native_moodle_database->get_records_sql()
    * line 163 of \enrol\attributes\lib.php: call to enrol_attributes_plugin::process_enrolments()
    * line 262 of \lib\cronlib.php: call to enrol_attributes_plugin->cron()
    * line 61 of \admin\cli\cron.php: call to cron_run()

    Any idea what might be causing it?
    I also changed around the user profile fields at the same time to fix a syncing issue, so it may not just be the upgrade.
  • Picture of Hemn Baker
    Wed, Aug 20, 2014, 10:27 AM
    I am tryin got restrict users by email addresses.
    First we have a different url for student emails
    and each username is specific in someway to the department or year within the department.
    I am not sure how to achieve that or even if that is possible.
  • Picture of Rasmus Kongshøj
    Thu, Oct 16, 2014, 10:14 PM
    Is there a way to make this work in 2.7?
  • Picture of Rasmus Kongshøj
    Thu, Oct 16, 2014, 10:14 PM
    Is there a way to make this work in 2.7?
  • Picture of Aaron Martin
    Tue, Dec 16, 2014, 3:54 AM
    I just upgraded to moodle 2.7. The screen-shot you posted makes your plugin look pretty straight forward but the version that is released for moodle 2.7 looks nothing like the screen shot. In fact, it only has one field to input data into. Can you give an example of how to use this one? Thanks
1 2
Please login to post comments