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:
1219 sites
384 downloads
99 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, 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).

    Thanks
    Scott
  • Aaron Cauchi
    Tue, Nov 24, 2020, 4:13 AM
    I created a custom profile field which is registration date. I want to use this profile field to enrol users to a specific course but they must be already registered for more than two years from present month and year (today's date) to be able to do course. Can you assist as what to language or formula to use? I tried using Now()) > 24 and also TODAY() - 730 > date but to no success.

    Appreciate any help
  • Fri, Feb 5, 2021, 10:48 PM
    I've run into an issue with the Enroll by profile field. While testing the plugin, I found an issue with the Auto unenroll when attribute expires. Once my test user was unenrolled from the test course used for testing this enrollment method, no matter what I've tried, he can not be enrolled in any course using Enroll by profile field.

    Course: Test Course #1
    Custom Profile Fields: Field 1 (first, second, third), Field 2 (1, 2, 3)
    Enrollment Method: Enroll by profile field, Field 1 = first
    User: User One
    Profile Fields: Field 1 = First, Field 2 = 2

    User enrolled.
    Changed Field 1 to second
    User unenrolled
    Changed Field 1 to First
    User not added to course.
    Purged all enrollments, ran tasks, cron job, forced enrollments, user not enrolled.
    Created New Test Course
    Configured the Enroll by profile field the same as for Test Course 1
    Users enrolled, but not Test User 1.
    Changed enrollment rule to use Field 2 = 2, users enrolled, but not Test User 1.

    I can verify that the user profile fields contain the expected values, that users can be enrolled and unenrolled, but not re-enrolled or enrolled in other course once a attribute changes and the user is automatically unenrolled.

    Any ideas? I'm at a loss.
  • Sat, Feb 6, 2021, 12:52 AM
    Hello Niall,

    Thanks for reporting this, this is not as it should work. Could you please post this in the bug tracker ? see link on this page. This way I can keep track on things that need looking into or be corrected.

    Thanks!
  • Tue, Mar 23, 2021, 10:17 PM
    What triggers the enrolment? Is the user required to login for the enrolment to happen? Are there any settings to adjust how/when the enrolment happens? Will running cron update the enrolments according the rules we create with this plugin?
    We would like the rule to run often enough that a login is NOT required for the enrolment to happen. We want to rely on this plugin to enrol users as the rule is completed and/or users pass the crtieria - often enough so we can see who is enrolled (expected according to the rule) and the records and statistics.
  • Mon, Mar 29, 2021, 2:55 PM
    Dan,

    You'd have to test and play around a little to see how this works for your particular setup. By default, the checks are made upon each login, but as in my case this could seriously slow down logins I made this optional. Then the cron job runs as specified under your Admin menu > Scheduled tasks, so you could change the frequency of this specific task. However be aware that for large site using many rules each task run could take several minutes. So it remains to be checked whether this is feasible at all. To discuss any specifics, please open an issue in the bug tracker (whether there is an actual issue or you make a request for enhancement).
  • Wed, Mar 31, 2021, 3:12 PM
    Hello, Nicolas.

    I installed the plugin and made the necessary changes. My scenario is that students must view the course based on a custom user field that I created. I don't see the course when I log in, but I do if I click the force enrolment now button in the plugin settings. Is there anything else I'm overlooking?
  • Tue, Apr 6, 2021, 2:13 PM
    Hello Sree Vishnu,

    In the main plugin settings in the Moodle administration, you can check the "Enrol users immediately at login" checkbox; this will process the rule immediately upon each login. In all other cases, the rules are processes periodically as specified in the scheduled task's schedule under Administration > Server > Scheduled tasks > "Process all rules and enrolments for Enrol by user profile fields". HTH
  • Thu, Apr 15, 2021, 7:49 PM
    Hello Nicolas,

    I've got a small question. Where in the db is are, the selected profilefields wich you want to use for enrolment, stored? (enrolsettingsattributes)

    kind regards Koen
  • Thu, Apr 15, 2021, 9:16 PM
    Hello Koen,

    it should be either in the mdl_config or mdl_config_plugins table.
  • Fri, Apr 16, 2021, 5:46 PM
    Thanks a lot!!!

  • Mon, Apr 19, 2021, 11:31 PM
    Hi Nicolas,

    I have found the data table with the enrol attributes.

    What I'm actually looking for is where the data / profile fields are stored that may be used for the enrollment on the course page.

    When I have created a profile field and placed it manually in the db config_plugins, this profile field is not yet visible at Enrol by user profile fields in the course.

    Hopefully you can provide me with an answer.

    Is it stored in de cache or a other db table?

    THX
Please login to post comments