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:
1345 sites
110 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.


Screenshot #0


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

Comments RSS


  • Sat, Nov 9, 2019, 4:24 AM
    Hi, Nicolas

    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,
  • Mon, Nov 25, 2019, 4:33 PM
    Hi Leslie,

    Sorry about the late reply. What I can suspect is that there is a timeout on the scheduled task. This can happen because the "Force" and "Purge" act on one enrollment (course), but the scheduled task acts on all defined rules in all courses.

    Do you run the cron by Web (page call) or CLI (command-line) ? I would recommend to try and run the cron by command line and see whether there still is a timeout and if so whether any more specific error is displayed.

  • Fri, Jan 24, 2020, 9:08 PM
    Hey Nicolas

    I installed your plugin on a Moodle 3.4 site. When I go to Enrolled Users, I can see the info, cog and bin icons for users that I've enrolled using other enrollment methods, but not by users that have been enrolled using this plugin. If I select the user and then below the list go to "With selected user..." and select "Delete selected user enrolments", it just reloads the page and gives me a message "No users selected".

    Do you perhaps know how I can delete one specific user enrollment when the user was enrolled using your plugin?

    Kind regards,
  • Thu, Jun 4, 2020, 5:29 PM
    Hi Nicolas,
    I've installed the correct build for my moodle environment (2018092300). But when I add them as an enrollment method the plugin doesn't show itself very good. I cannot see the three buttons (add, brackets, delete), i only see some crooked text which is not readable.
    My moodle version is: Moodle 3.2+ (Build: 20161222) and I've installed enrol_attributes_moodle35_2018092300. I've tried to install the 2000 version but it gives the same result.
    I really haven't got a clue where to look for the solution. I hope you can help smile.

    Thanks in advance.
    Kind regards,
  • Thu, Jun 4, 2020, 5:32 PM
    Hi Noortje,
    This plugin is know to have some display issues with some third-party themes. Could you mention which theme is active in your Moodle installation ?
    Moreover, I have to point out that even if this plugin functionally supports Moodle 3.2, this Moodle version is long out
    of date.
  • Thu, Jun 4, 2020, 5:33 PM

    Sorry, your comment espaced my attention. This plugin doest not allow individual user deletion (unenrollment), as presumably the user would be enrolled again after a while if his profile fields match the enrollment rule.
  • Sat, Aug 15, 2020, 1:23 AM
    Excellent plugin, it has helped me a lot. Thank you so much for everything. Would it be possible to integrate the functions of start date and end date to carry out the enrollment? It would be great if dates could be controlled. Thank you very much.
  • Sat, Aug 15, 2020, 3:45 AM
    Thanks Israel for your feedback. Indeed this could be a good improvement. I'm not making any promises, but please suggest this as a new issue on GitHub (see "Source control URL" link above), so we can discuss this in detail.
  • Sun, Aug 16, 2020, 11:47 AM
    Thank you very much Nicolas Dunant. I will put the suggest on GitHub right now. Have a nice day
  • Wed, Sep 2, 2020, 10:00 PM
    Are you still supporting this?
    If so, I am running moodle 3.5 and have tried installing all 3 versions that say they are verified for my version. All 3 install and configure correctly, however when I try to add the method to a course I'm getting an error:

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator at webmaster@disasterrelieftraining.com to inform them of the time this error occurred, and the actions you performed just before this error.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

    Server log only shows this: [01-Sep-2020 19:04:03 America/Chicago] PHP Notice: Undefined index: State in /home/onlinedi/public_html/lib/navigationlib.php on line 1898

  • Wed, Sep 2, 2020, 10:59 PM
    Hello Jeff,

    Yes this is still functional and fully supported in supported Moodle versions. To track down the problem, I would advise to make your Moodle display debug messages that could provide you a lead on the cause of the error. The "php notice" log entry is not related to that "Internal Server error" that you see.

  • Thu, Sep 3, 2020, 12:45 AM
    Thanks Nicolas.
    I have all the debugging already turned on. Im not sure where I should look for the debugging messages.
    When I try to add that enrollment method it immediately goes to a generic white screen with that error - no debug info.
  • Thu, Sep 3, 2020, 12:59 AM
    Now I also have a dev site and when I add the enrol method it seems to work but when I edit it , the settings don't stick and I get this error:

    Debug info: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB 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 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
    line 1273 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
    line 120 of /enrol/attributes/edit.php: call to mysqli_native_moodle_database->get_records_sql()
  • Thu, Sep 3, 2020, 2:59 PM
    Jeff, it look like the method you are adding just contains no parameters, hence the empty Array() in the debugging message. Please post in the bug tracker if you want this issue followed properly – it allows for more direct communication and posting of screenshots etc. Thanks!
  • Sat, Sep 19, 2020, 2:27 AM
    First of all, I love this plugin, this is going to make a big difference in my agency for enrolling my employees.

    I am going to give a little background to help with making these questions make more sense.
    We are a State Public Health agency. We have both internal and external users on our system. In some of the courses we want our employees only, in others external only, and other both.

    This brings up 2 questions that I have.
    1: I saw on the Github entry for the plugin someone requested a NOT function to go along with the AND/OR function, is there movement on that? I would like to see this as well.
    2: I am going to use an example of email addresses. In the system, our employees have a @mt.gov address where external users do not. Is there a way to select just the mt.gov addresses. For example *@mt.gov. Where it would only select those with the email address. Or if using the employee ID number, all profiles that have an employee id number in the field but exclude the ones who do not (which would be external users).

Please login to post comments