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:
1311 sites
222 downloads
120 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

  • Wed, Oct 21, 2015, 6:23 PM
    Hello,

    Please ensure the following :

    1.- In Site Administration > Users > Accounts > User profile fields, here are the user profile fields that can be used by the plugin.
    2.- In Site Administration > Plugins > Enrolments > Enrol by user profile fields : the default role should be set and in the "Profile fields to be used in the selector" the user profile fields you want to use with the plugin have to be selected, then save the options.
    3.- In that same screen, leave the Shibboleth Mappings field empty.
    4.- In a test course, go into Course Administration > Users > Enrolment methods and create a new "Enrol by user profile fields method" : optionally give it a name and – that's mandatory – a rule set, it can be one simple rule or a set of rules.

    Users are then enrolled when they next login, or when you click the "Force..." button within the enrolment instance settings.

    Just note that if any user is already enrolled in the course (i.e. by another enrolment method), that user is skipped by the plugin.
  • Wed, Nov 11, 2015, 10:30 AM
    Hi there,

    I set up everything exactly like you described in your manual above. Unfortunately it does not enrol any of my test user. I tested it with Moodle 2.8 and Moodle 2.9.2. If I run cron manually I see the following error

    Running cron for enrol_attributes...
    ... used 3 dbqueries
    ... used 0.018087148666382 seconds
    Scheduled task failed: Legacy cron processing for plugins,Error reading from database

    Any ideas why it won't work?

    Many thanks!
  • Thu, Nov 12, 2015, 1:21 AM
    Ok, I just activated the debugging modus in the plugin. To be a bit more concrete I'm getting the following error:
    --------------------------------------------------------------------

    stdClass Object
    (
    [rules] => Array
    (
    [0] => stdClass Object
    (
    [param] => Key
    [value] => ABC
    )

    )

    )

    line 95 of /enrol/attributes/edit.php: call to debugging()

    Array
    (
    [select] =>
    [where] =>
    )

    line 97 of /enrol/attributes/edit.php: call to debugging()

    SELECT DISTINCT u.id FROM mdl_user u WHERE

    line 99 of /enrol/attributes/edit.php: call to debugging()

    Error reading from database

    More information about this error
    Debug info: 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 u.id FROM mdl_user u WHERE
    [array (
    )]
    Error code: dmlreadexception
    Stack trace:

    line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown
    line 1080 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
    line 100 of /enrol/attributes/edit.php: call to mysqli_native_moodle_database->get_records_sql()
    ------------------------------------------

    Any ideas?
  • Mon, Nov 16, 2015, 6:39 PM
    Dear Nicolas,

    I have some custom profile field in moodle and when i am adding this enrolment plugin in moodle and setting rules to automate user enrollment in course and when user matching the criteria could not enrolled and also when I am clicking force enrollment button but still it is not working.
  • Mon, Nov 16, 2015, 10:41 PM
    Hello Sudhanshu,

    This is a known problem that I'm currently fixing. If you're confortable using a pre-release version of the plugin, you can try out the latest release available on GitHub (see the "Source control URL link near the top of this page). If not, I should release an official new version of this plugin within a couple days.
  • Tue, Nov 17, 2015, 2:08 PM
    Thanks Nicolas for building this great plugin , I will wait for new release.

  • Tue, Nov 17, 2015, 8:45 PM
    Dear all,

    I've just released a new version of this plugin, which addresses all known problems. It is available immediately, and also officially supports Moodle 3.0.

    Thanks to all who reported bugs, and especially to Martin from Canada and Kathrin from Germany, who wen to great lengths to provide details of their debugging sessions.
  • Wed, Nov 18, 2015, 10:00 PM
    Superb - works really well, thank you. Would it be possible to show the standard user profile fields (eg. city/town, country) as well as custom profile fields?
  • Wed, Nov 18, 2015, 10:22 PM
    Thanks Jon.

    Yes, I would like to add this in the future. I've added this as a feature request (see https://github.com/ndunand/moodle-enrol_attributes/issues ).

    In the meantime if anyone is willing to work on this feature I'd be glad to include it.
  • Thu, Nov 19, 2015, 2:58 PM
    Dear Nicolas,
    Thankyou Nicolas for releasing this plugin once again and fixing issues. You have done really a goodjob by making this plugin.

    Once again thankyou smile
    Sudhanshu

  • Wed, Dec 16, 2015, 10:27 AM
    Hello, where do I set the duration of enrollment? When I look at the student in enrolled users, I do not see an enrollment end date.
  • LionHeart stretching
    Thu, Dec 24, 2015, 2:58 AM
    Tyler, it looks like there's no ability to define duration (with expected UI interactions) with this plugin unfortunately.

    Nicolas, great work here thank you! It's plugins like this that add basic functionality yet drastically improve efficiency that I enjoy using. No duration/expiration feature aside, still an excellent plugin.

    Could this functionality be extended to work with group enrolment keys also?
    Or what about some method to assign a role to a category, such as listing them along with the role in relation to a defined custom profile field?
  • Wed, Jan 6, 2016, 5:07 PM
    Tyler, indeed there is no such functionality yet.
  • Wed, Jan 6, 2016, 5:08 PM
    Justin, thanks for your feedback. Could you elaborate on how you would see the plugin work with group enrolment keys? I'm not sure to understand.
  • On the jetty
    Mon, Jan 25, 2016, 10:21 PM
    Hi

    Thanks for this plug-in, I am struggling to get it to work however sad

    When I installed and ran an enrolment instance I got a database access error as it was looking for the wrong user name field trying for mdl_user, whereas my db prefix is nmdo.

    So I changed line 102 in the attributes/edit.php (changing 'SELECT DISTINCT u.id FROM mdl_user u ' to 'SELECT DISTINCT u.id FROM nmdo_user u ' )

    The error has gone but the plug-in still will not work, I am trying to enrol based on a drop down profile field value.

    Any ideas or suggestions to investigate much appreciated.

    Thanks

    Roger
Please login to post comments