Enrolment: Enrol by user profile fields

enrol_attributes
Maintained by Picture of Nicolas Dunand Nicolas Dunand
This plugin allows users to be enrolled according to any value stored in their user profile.
527 sites
639 downloads
36 fans

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

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 Kate Rhodes
    Fri, 16 Jun 2017, 8:44 PM
    Hi Nicolas,
    The default role only shows one profile field - and it's the one that I created "Profile Fields" - it doesn't allow me to choose any other profile field, nor does it allow me to choose anything further. I do have the plugin enabled as well. If I could attach as screen cap it might explain better what I'm seeing, but I don't have that option here. sad
  • Picture of Nicolas Dunand
    Fri, 16 Jun 2017, 9:00 PM
    Hi Kate,
    This is a limitation of this plugin, it only works using custom profile fields (i.e. the one(s) you created yourself). So no standard fields can be used.
  • Picture of Kate Rhodes
    Fri, 16 Jun 2017, 9:12 PM
    Okay, that's not a problem... that's the profile field I want to use anyway, but I still can't get it to show up at the course level. I still only get "self / manual" enrolment. I have the plugin installed in a Moodle 3.1.2+ site. I'm using "Academi" as my theme. Could that be an issue?
  • Picture of Nicolas Dunand
    Fri, 16 Jun 2017, 9:27 PM
    Theme should not be an issue – it could make things display incorrectly, but not disappear completely. So, the other possible issue is that you need to have the 'enrol/attributes:config' permission in that course, and that is normally only for managers (i.e. not for teachers). What role do you have in that course?
  • Picture of Kate Rhodes
    Fri, 16 Jun 2017, 9:30 PM
    I'm the administrator for the site. smile
  • Picture of Nicolas Dunand
    Fri, 16 Jun 2017, 9:55 PM
    Kate, yes that's what I thought. I can't come up with any more ideas but PM me if you want me to further investigate this.
  • Picture of Dario Pappalardo
    Fri, 30 Jun 2017, 4:53 PM
    Hi Nicolas, first of all thank you for this useful plugin. Just a suggestion: it would be great to have the chance to choose between "the field is euqal to" and "the fild contains". Don't know if it's feasible but it could be helpful.
    Thank you again for your contribution.
  • Picture of Nicolas Dunand
    Fri, 30 Jun 2017, 5:12 PM
    Hi Dario,

    Thanks for your feedback and suggestion. Indeed it would be very useful – and so would be other operators (greater than, etc.) – but I have really not time at all to do that in the foreseeable future.

    If somebody was willing to program it I'd be very happy to integrate it so that everybody could use.
  • Picture of Dario Pappalardo
    Fri, 30 Jun 2017, 5:33 PM
    Same here Nicolas, I'd like to implement that function from your basis but ain't got no time... Hope that someone will continue your work. Anyway, again, great job
  • Picture of Lynn Danzig
    Tue, 18 Jul 2017, 5:18 PM
    Hi
    Thanks for a great plugin.

    I am having trouble working out why I am not able to enrol based on a user profile I have set up.

    I have created a custom profile field and successfully updated records of 20 users with a particular value I want to use for enrolment.

    I can find these users by filtering on the field and value in Browse users in site admin.

    When I go to a course, I can select the enrolment method and it brings up the correct field and I can enter the value.

    There is no error message but in the enrolment data box it shows 0 users have been enrolled with this method.

    I am logged in as admin so permissions should not be an issue.

    I was able to enrol a cohort, so it should not be to do with course or user expiry (I am working on a dev site).

    Any suggestions?

    Many thanks
    Lynn
  • Picture of Nicolas Dunand
    Tue, 18 Jul 2017, 5:35 PM
    Hi Lynn,

    Thanks for your message. What happens if, after having saved your rule, you display it and click the "Force enrolments" button?
  • Picture of ray cheng
    Wed, 19 Jul 2017, 1:39 AM
    Hi, First of all, thanks for sharing this plugin.

    I installed moodle 3.3 version using mysql 5.6.36 and I have install this plugin.

    I have added 2 other fields (named field1 & fields) in user profile. However, when I selected the "Enrol by user profile" (in Users > Enrolment Methods) , the error showed as below

    customtext1=line 112 of /enrol/attributes/edit.php: call to debugging()

    Notice: Trying to get property of non-object in /var/www/html/moodle/enrol/attributes/lib.php on line 128
    fieldsandrules= Array ( [customuserfields] => Array ( [1] => field1 [2] => field2 ) [rules] => )
    line 114 of /enrol/attributes/edit.php: call to debugging()

    Warning: Invalid argument supplied for foreach() in /var/www/html/moodle/enrol/attributes/lib.php on line 149
    arraysql= Array ( [select] => [where] => [params] => Array egg )
    line 116 of /enrol/attributes/edit.php: call to debugging()
    sqlquery= SELECT DISTINCT u.id FROM {user} u WHERE
    line 119 of /enrol/attributes/edit.php: call to debugging()

    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 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
    line 1175 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()

    Hope anyone can help. Thanks in advance.
  • Picture of Nicolas Dunand
    Wed, 19 Jul 2017, 2:23 PM
    HI Ray,

    Thanks for reporting this problem. First, can you confirm you have the latest version of this plugin ?

    Then, does this error appear as you're trying to create a new enrolment method ? Or when displaying an existing one ?
  • Picture of ray cheng
    Wed, 19 Jul 2017, 10:13 PM
    Hi Nicolas,

    Thanks for your prompt reply.

    My installed plugin version is 2017050100. And the error appears when displaying an existing one.
  • Picture of Nicolas Dunand
    Thu, 20 Jul 2017, 4:33 PM
    Hi Ray,
    This looks like what would happen is the rule set is completely empty (see "customtext1=" at the beginning of your debugging messages). There should be something there, not just nothing. Have you set up a rule ? If you reload the page with JavaScript turned off, you should see the code (JSON) for the rule, e.g. "{"rules":[{"param":"paramname","value":"somevalue"}]}". is that the case?
1 2 3 4 5 6 7 8 9 10 11
Please login to post comments