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:
1390 sites
132 fans
Current versions available: 6

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)
CSE Université de Lausanne: Supporting institution
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Rudraksh Batra
    Sun, Mar 5, 2023, 4:19 PM
    Hi, I am trying to use this plugin, however in my case it is not showing the fields in drop down, even after creating

  • Ben Girard
    Wed, Apr 5, 2023, 12:22 AM
    Based on the comments.... The lack of clear steps on how to configure and use this plugin must drastically negatively impact its adoption. I installed it, enabled it, yet there are no rules options or place where I can find how to configure it.
  • Ben Girard
    Wed, Apr 5, 2023, 12:23 AM
    Also, why is this plugin only manages custom user profiles and not all user profiles?
  • Rudraksh Batra
    Wed, Jul 12, 2023, 6:36 PM
    Hi I hv enrolled 400 user using this plugin in 1 course, now i want to unenroll 5 users out of that, can you please advise, as i am not able to delete the enrollment, as course only show delete for self enrollment and manual enrollment
  • Rudraksh Batra
    Wed, Oct 4, 2023, 12:20 AM
    Hi, can you please help i am using this plugin, however, whenever i register and login it is not allotting a course to that user, even though i selected the option to enroll on login itself, can you please advice what could be the reason, now what is happening it is enrolling, whenever enroll by user profile cron is running at a gap of 1hr.
    earlier it was running fine, whenever user click the confirmation link, it allot student role.
  • Paula Rosado Jiménez
    Tue, Nov 14, 2023, 6:07 PM
    I cant suspend/activate students when I use this enrol method. It is possible?
  • Nicolas Dunand
    Tue, Nov 14, 2023, 6:24 PM
    Hello Paula,
    Indeed this is not possible to either modify (e.g., suspend) or remove a user enrolment when enrolled by this plugin. Even if it was, the plugin would re-enroll the person automatically later on (either on login or when the scheduled task is run, depending on the plugin settings).
  • jeremy leening
    Fri, Nov 17, 2023, 6:53 PM
    Where you can set: Profile fields to be used in the selector, it may look like your custom profile field is selected but i had to press it again and save changes to be able to see the enrollment method.
  • Brian
    Thu, Nov 23, 2023, 5:03 PM
    Is there any method to manage rollovers? So academic year 2023_4 year 1 student then gets 2024_5 year 2. However, it looks like each field is a singular item e.g. cannot be comma or semi colon separated. One profile field can enrol in many different courses, but we seem to need multiple profile fields per academic year. Plus the complexity of different strands in HE suggest needing very complex enrolment by fields filtering per course.
  • B G
    Sun, Feb 18, 2024, 11:42 AM
    Brilliant plugin! yet, impossible to configure. Where is the menu to define enrollment rules a shown in the screenshot? There should be steps in the instructions on how to configure it once installed.
  • B G
    Sun, Feb 18, 2024, 11:59 AM
    Finally, I found out that the interface to use this plugin is INSIDE of each course, under participants/enrolment method. It is quite buried.
  • Marie Waterhouse
    Wed, May 1, 2024, 11:29 PM
    Can I use Filter Codes plugin to auto populate the custom profile fields for this plug in? Potentially fantastic plug in for us where a complex logic is used to determine access to a course. Thank you.

  • Nicolas Dunand
    Thu, May 2, 2024, 3:04 AM
    Sorry for keeping your questions unanswered.

    Now multi-valued arguments are supported in the latest version, make sure to check it out.

    I'm not sure which Filter Codes plugin you're referring, to. Could you elaborate?
  • Marie Waterhouse
    Thu, May 2, 2024, 6:28 PM
    Hello Nicolas,
    I use FilterCodes https://moodle.org/plugins/filter_filtercodes it is very versatile.
    It allows you to auto populate using plain text tags. I've just done a load more testing and I don't think this plug in does pick up the filter codes values. Or I could be doing it wrong. It would be amazing if this plugin could pick up plain text tags.

    Am using Moodle 4.0

    Many thanks

    I have tested the following

    I want to be able to enrol my users to a course using your plugin if they meet the criteria 'is member' and 'has paid' The 'is member' criteria changes and is dynamic, the 'has paid' state is static and a one off. Both are decided in a different course.

    So I have created two custom user profile fields
    The first field 'is member' uses the filter code
    {ifhasarolename roleshortname}{/ifhasarolename}: Displays enclosed content if the user has been assigned the specified role anywhere in the Moodle site within any context.
    which i change to
    {ifhasarolename member}Member{/ifhasarolename}
    So if this condition is met, the text in the custom profile field displays Member

    The second custom profile field is 'has paid'. I manually fill this in with 'yes'.

    When I set up your plug in I use the user profile rules

    'is member' = Member
    'has paid' = yes

    With testing in various combinations and using different types of custom profile fields, I can not get this plug in to recognise the the filer code returned value 'Member'
  • Mike North
    Fri, May 3, 2024, 1:27 AM
    Hi, thanks for this great plugin.

    I have used it to enrol users based on a numerical value from a drop down field in the user's profile (i.e. if value = 2).

    This worked (but not automatically, I had to click "Force enrolments now), however when the value of that field changes (e.g. new value = 0) the user is not unenrolled from the course even though I chose the option to "Unenroll user" in the "Behaviour after attributes expiration" field.

    Three questions:
    1) Does this plugin not recognise changes to drop down fields? If it does, how can I use this plugin to automatically unenroll users who no longer match that profile field value?

    2) Can the plugin automatically add users who match the profile field conditions or do I have to click "Force enrolments now" every time new users are added to moodle / user fields are updated?

    3) If using values from a checkbox, what do I enter in "User profile fields rules"? I've tried "yes" and "true" and neither work.

Please login to post comments