General plugins (Local): Profile field based cohort membership

Maintained by Picture of Ulm UniversityUlm University, Picture of Alexander BiasAlexander Bias, Picture of Kathrin OsswaldKathrin Osswald
Moodle plugin which lets admins manage cohort memberships based on users' custom profile fields
746 sites
46 fans

Moodle core provides a mechanim to manually fill cohorts with users (on Site administration -> Users -> Accounts -> Cohorts). This is fine for small Moodle installations where the cohort members don't change too often and where the Moodle admin has plenty of time to update the cohorts.

Now, larger or fragmented Moodle installations may have the need to manage a large number of cohorts which have a large amount of members and which may also change quite often. Managing cohorts by hand in such scenarios is simply unprofessional overkill - even / particularly if you distribute the work among multiple Moodle admins.

On the other hand these large or fragmented Moodle installations might already have some custom user profile fields which can be leveraged to decide which cohort(s) a user should be a member of. This plugin implements a simple solution to manage cohort memberships based on a users' custom profile field.

Please see README file for details about the usage and features of this plugin.

No support in the comments section on this page

Please note that we don't provide any support for this plugin in the comments section on this page anymore.

We appreciate your commendation and reviews for this plugin in the comments. For bug reports and support requests, please read the extensive information in the plugin's README file first and create, if needed, a ticket in the bug tracker which is linked below.

Thanks for your cooperation.


Screenshot #0


Picture of Ulm University
Ulm University (Lead maintainer)
Picture of Alexander Bias
Alexander Bias: Developer
Davo Smith: Initial developer
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Gerhard Schwed
    Sun, Nov 26, 2017, 12:13 AM
    Thanks for this plugin. It works fine.
    But why is it restricted to only custom profile fields. Many information is often stored in one of the default profile fields like country, institution, department. It would be great if I can use also these fields.
  • Picture of Alexander Bias
    Mon, Nov 27, 2017, 3:56 AM
    Hi Gerhard,

    there is a simple answer to your question: When we wrote this plugin, we only had the need to process custom profile fields. And as custom profile fields and core profile fields have to be handled differently in code, the work for core profile fields was never done. Additionally, I hope that some day in the future, all core profile fields except firstname, lastname and email will be move to custom profile fields (MDL-28452 would solve the most urgent part for that).

    We don't have plans to extend this plugin to core profile fields, but would be willing to review a pull request if someone else would do it in a clean way. That's all I can offer at the moment.

  • Picture of Nanda Yuvaraj
    Fri, Jan 19, 2018, 8:24 PM
    Hi am using this plugin .. i have created the rules ... but the users are not being moved to the cohorts.. MAy i know if there is some other settings to be made?
  • Davo
    Fri, Jan 19, 2018, 8:30 PM
    Nanda - please look at the description at the top of this page for details of how to sort out any problems with this pluign.
  • Picture of László Pauer
    Thu, Feb 8, 2018, 11:00 PM

    What are the capabilities connected to this plugin? If I want to create a role with capabilities only to use this plugin, which would they be?

  • Davo
    Thu, Feb 8, 2018, 11:02 PM
    Laszlo - the only capability used by this plugin is moodle/site:config. It is not possible to give a user access to this plugin without giving them site admin access.
  • Picture of Gerhard Schwed
    Fri, Jun 29, 2018, 3:15 AM
    I like this plugin. But why is it limited to custom profile fields?
    We need to create cohorts based on standard profile fields like 'institution' and 'department'.
    Is it possible to allow also the default fields?

    Thanks in advance,
  • Picture of Alexander Bias
    Fri, Jun 29, 2018, 3:53 AM
    Hi Gerhard,

    if you scroll up, you will see that you already asked this question in Nov 2017 and that I answered it. Nothing has changed since then.

  • Picture of Tamar Alania
    Mon, Aug 20, 2018, 4:40 PM
    I have some problem with the plugin. Cohort remains empty in every cases. Can someone help me with the case?

  • Picture of Corey Dodge
    Wed, Oct 3, 2018, 1:23 AM
    Is there a way to add a different conditional rather than just "if matches". I would like to use "if not" match put into a certain cohort. Such as I have one cohort that only needs to match one conditional and I want everyone else (not including those in the other cohort) into a separate cohort. How can I accomplish this?
  • Picture of Tamar Alania
    Fri, Oct 19, 2018, 5:33 PM
    Hello Corey, there was a probe with cron and now it works. But i now i have another problem, when some user are divided in course by position, after changing position the activity results are losing about the user. for example the user's quiz information etc.
  • Picture of Majid Hussain
    Fri, Jul 5, 2019, 8:16 PM
    Hello, this plugin is very handy. The only problem we have with it is that it loads very slowly when there are lots of rules as in our case. We have nearly 500 rules ( and the page takes a good minute to load all of the data. Can you add pagination as a setting so admins can choose to display let's say 50 rules per page? Regards, Majid
  • Picture of Edd Clementson
    Fri, Jul 19, 2019, 2:15 PM
    +1 If setting alot of rules the plugin becomes unusable unfortunately because the page won't load. Hopefully introducing pagination would resolve this problem we've experienced on a few occasions. Would be very grateful if a developer could investigate smile
  • Picture of Alexander Bias
    Tue, Jul 23, 2019, 5:29 PM
    Hi Majid, hi Edd,

    thank you for your input.

    If you look at the top of this page, you will find a note that feature requests and issues must be directed to If one of you could create an issue in Github, we will be more than happy to discuss the topic there.

  • Picture of Timothy Johnson
    Thu, Sep 26, 2019, 5:16 PM
    Allowing the user to skip the enrol page is great. It would be nice to have the option to specify a cohort to allow to Auto-Enrol.
1 2
Please login to post comments