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.
749 sites
501 downloads
60 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)
Picture of RISET Université de Lausanne
RISET Université de Lausanne: Supporting institution
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Sarah Ruth Finkel
    Thu, 16 Aug 2018, 5:54 AM
    Hi Nicolas, Thank you for this plugin! There is not a lot of documentation so I have a question about the "Force enrolments now" button. I was able to get the plugin working correctly on Moodle 3.4. I have one custom user profile field (a dropdown with a handful of options) which are the eligible options to enroll students into the course. If the student self-registers and chooses the correct option from the dropdown menu of this field, they are automatically enrolled in the course. It doesn't seem like there is that 6 hour cron delay as mentioned in the other comments. We do have cron set up to run every 5 mins or so. It's important that they are able to immediately access the course. What exact do the "Force enrolments" and "Purge enrolments" buttons do?

    Eventually, we are going to open up registration so that anyone who self-registers will be able to access the courses. How will using this plugin affect this? We want the students enrolled this way to stay enrolled in the course so I'm not sure if the "Unenrol after attributes expiration" would help or interfer with this?

    Again, this plugin may be a lifesaver for our use case. I just want to make sure it will meet all of our needs smile
  • Picture of Nicolas Dunand
    Thu, 16 Aug 2018, 3:14 PM
    Hi Sarah,

    That's a great use case and I'm glad the plugin helps.

    1. The "Force enrolments" and "Purge enrolments" buttons are there so that you can fiddle with a rule and see immediately if and how it works (by seeing how many users are enrolled), or if you want to make sure that a rule change takes effect immediately.

    2. Self registration and Attributes registration are independent and additive. That is, a user can be enrolled into a course by either method, or both – it won't make any difference to them.
  • Picture of Kelvin Osondu
    Tue, 21 Aug 2018, 5:36 AM
    Hello,

    How do i unenrol a participant who has been enrolled with this plugin?

    Without purging enrolments, is there a way to unenrol a single participant who signed up via the user profile field?

    Because I can't seem to unerol the user with manual or self-enrollment.

    I await your response.
  • Picture of Андрій Чорний
    Tue, 11 Sep 2018, 5:43 AM
    Hi! if user profile field is array (1,2,3,4). how can i work with it?
    if it's PHP - where to watch the code? Or is it mysql request?
  • Picture of Nicolas Dunand
    Tue, 11 Sep 2018, 4:25 PM
    Hi Андрій,
    It is a SQL query made from the PHP in https://github.com/ndunand/moodle-enrol_attributes/blob/master/lib.php#L181 . See on that line 181, you can change ";" to "," (4 places, L181 and L 182) to make it work as you want.
  • Picture of Koen Moret
    Fri, 14 Sep 2018, 3:37 PM
    Hello Nicolas,
    It's a great plugin THANX. I've made a simple script to check if a specific profile field with a specific value exist is true then they will enroll into the course with your plugin.
    Now i don't want to wait for 6 hours. Is there a function in your code wich i have to call or can you tell me which cron job i have to execute to enroll right away?
    Thank you!!!
  • Picture of Nicolas Dunand
    Fri, 14 Sep 2018, 4:34 PM
    Hello Koen,

    You should be able to simply call enrol_attributes_plugin::process_enrolments() to force the plugin enrolments routine to run.
  • Picture of Koen Moret
    Fri, 14 Sep 2018, 5:54 PM
    Thank you for your reply. Its's a php script in the root of moodle. I haven't got the knowledge yet to a accomplished that. I think i have to build a plugin by myself to understand the code in moodle. THX.
  • Picture of Krisectio Vebrina Lumban Raj
    Wed, 24 Oct 2018, 11:51 AM
    Hello, glad that i find this forum. im facing the same problem. I've made an enrollment by user profile, and according to this forum i have to wait for 6 hours, but after waiting for 1 day, it doesnt seem workout. can you help me? is there anything that i have to do? using moodle 3.4
    Thank you
  • Picture of darwin palma
    Sat, 10 Nov 2018, 12:58 AM
    Hi Nicolas, I'm working on Moodle 3.3 and I am using the theme adaptable.
    I installed your plugin but when i go to configurations, it showme nothing.
  • Picture of Georg Wiesinger
    Mon, 19 Nov 2018, 9:16 PM
    Hi, this plugin was working like a charm until a couple of days ago the automatic enrolment by user fields stopped at all! All settings remained untouched, the enrolment logic is working well when testing it with "force enrolment now", cronjob does work properly, no other plugins as well as Moodle updates installed until today when I was updating to the latest release 3.5.3+ (from older build 3.5.3+).

    May I ask if you could provide me with some tips or hints as I actually have no idea what the problem is?!

    Kind regards,
    George
  • Picture of Nicolas Dunand
    Mon, 19 Nov 2018, 9:24 PM
    Hi, which version of the plugin are you using? We've recently added a "Enrol users immediately at login" setting (no change, as it's "On" by default), to improve login speed.

    Things to check:
    1. Does "force enrolments" work as expected?
    2. If using the latest version, if "Enrol users immediately at login" is not checked, then enrolments are only processed when clicking "Force" or by cron, but not at each login anymore.
    3. Try to manually start this plugin's scheduled tasks (in Moodle admin > Server > Scheduled tasks).
  • Picture of Georg Wiesinger
    Fri, 23 Nov 2018, 3:50 PM
    Hi, thank you for your kind answer!

    I'm using the latest build of your plugin (2018092300) with the latest build of Moodle 3.5.3+! "Enrol users immediately at login" is checked. "Force enrolments" is working well, but executing the scheduled task "processenrolments_task" failed because of database write error! So I guess this is causing the issue, right? Is there anything I can do to get this process working again? The other task "invalidatecache_task" is working smoothly.

    Kind regards,
    George
  • Picture of Georg Wiesinger
    Fri, 23 Nov 2018, 4:28 PM
    Hi again, I finally found the issue in the database table "mdl_task_scheduled/processenrolments_task". "faildelay" was set to "86400" and I changed it to "0". Now everything works fine! smile

    No idea why this happened at all.

    Kind regards,
    George
  • Picture of Nicolas Dunand
    Mon, 26 Nov 2018, 3:39 PM
    Hi Georg,

    Thanks for reporting back. Without more information about the exact database error it will be difficult to debug any further. However, as forcing the scheduled task to run again solved the issue it is likely that what caused this was a temporary database condition.

    Glad to hear all is fine, cheers!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Please login to post comments