## General plugins (Local): Auto-cohort plugin

local_cohortauto
Maintained by David Thompson, Catalyst IT
Automatically adds users into auto-created cohorts, with names that derived from users' profile fields.
193 sites
13 fans
Current versions available: 1
This local plugin automatically adds users into cohorts, with names that derived from the users' profile fields.

Auto-created cohorts are made in the top-level system context (CONTEXT_SYSTEM).

This plugin is derived from, and intended to deprecate, the earlier auth_mcae plugin by Andrew Kama.

### Awards

• Fri, Aug 2, 2019, 9:30 AM
Approval issue created: CONTRIB-7799
• Tue, May 12, 2020, 5:05 AM
I really like this plugin, but I'm wondering why I get two cohorts for the attributes I'm using. For example, I have it setting up cohorts by a custom profile field called Status. For each value of this field, I get two cohorts. One is always significantly lower in number than the other. There is some overlap in membership, the overlap is not total. Can you provide any suggestions as to what we could do to resolve this?
• Sun, Jun 7, 2020, 12:13 PM
Does it work on Moodle 3.8/3.9?
• Mon, Jun 8, 2020, 5:39 AM
Hi Carly, I've just replied to you over on Github. Sorry for the delay.

Hi Ricardo, I don't yet know of any reason that it shouldn't work on Moodle 3.8/3.9, but I am afraid I haven't yet had an opportunity to test it.
• Tue, Jun 30, 2020, 4:44 AM
I have 3 custom profile fields that are check boxes. I need cohorts set up when the person has a check in the checkbox. If I just put the short name {{profile_field_xyz}} and nothing else on the set up page for the plugin I get "0" and "1" cohorts set up. So I saw in the forums and in the documentation that I can do this "xyz_{{profile_field_xyz}}" in the "mainrule_fld" field and then "1|XYZ1" in the "Replace array. 1 value per line, format: old_val|new_val" field. But nothing gets created. I have tried adding another replace array "0|XYZ0" as well and nothing gets created. But again I have 3 checkboxes that are custom profile fields. I added the "1|..." and "0|..." for each of them in the same order as the "mainrule" field but nothing gets created. So I don't know how to set this up.
• Thu, Aug 20, 2020, 6:15 AM
I'm going rapidly insane trying to make this work. I have a course set up which should only be available, but automatically available, to employees and partners. It should not be available to students.

I have {{ email.rootdomain }} set up as my template filter.

In the replace_array field, I have (CR/LF separated)
mycompany.com|Employees
partnercompany.com|Partners
partner2company.com|Partners
and so forth. (And about a thousand partner companies.)

So, what ends up happening is it's creating a new cohort for each partner company instead of dropping them into "Partners", and right now the Employees one isn't working, either, but it was before we upgraded to 3.9.

What might I be doing wrong?