Cohort role synchronization

General plugins (Local) ::: local_cohortrole
Maintained by Paul Holden
Automatically synchronize cohort members into system roles.
Latest release:
953 sites
48 fans
Current versions available: 3

Moodle Cohorts are a great tool for creating site-wide groups of users, and using these groups to enrol users en-masse into courses. This plugin extends the functionality of cohorts by allowing them to be automatically assigned to system-level roles.

This is especially useful for local customizations, i.e. you want your Staff Users cohort to be enrolled into all staff related courses, but also assign them to a system role that grants them extra permissions across the site. By listening for relevant events, any amendments made to configured cohorts will automatically be reflected in the appropriate roles.

After installing the plugin, linking a cohort to a role is as simple as selecting each from a dropdown menu and pressing Save changes:

Create Synchronization

See the project readme file for the most up to date instructions.

Supports Moodle version 4.1 onwards (up to and including 4.4).

Build status

The latest plugin release is 4.4 (22 April 2024):

  • Support for Moodle 4.4
  • Raised minimum requirement to Moodle 4.1


Screenshot #0
Screenshot #1


Paul Holden (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • C Behan
    Mon, Apr 18, 2016, 6:45 PM
    Hi Paul,
    Thanks for creating this plugin. I'm wondering if you plan to upgrade it for Moodle 3.0 on the repositary?

    Thank you, Catherine
  • Paul Holden
    Thu, Jul 14, 2016, 4:13 PM
    I've tested on latest 3.2 (dev) & all works as expected, so I've updated the list of supported versions to 2.6 -> 3.1 smile
  • Alexander Bias
    Mon, May 8, 2017, 5:27 PM
    Hi Paul,

    you might be interested that we created a plugin which provides a mapping from custom user profile fields to cohorts. It is published on and currently waiting for approval in the plugins repo.

    I have recommended your plugin in our plugin's README as a solution for mapping from custom user profile fields to system roles and we are using this combination in production.

    Thanks for your work!
  • Rob P
    Fri, Jun 2, 2017, 9:21 AM
    Hi Paul,
    Awesome plugin, just what we need for making our moodle site a little bit easier to maintain. It's working on our 3.2 test site right now but we're planning to push our site to 3.3 soon too and we're wondering if there are any known issues with it on 3.3 as it isn't officially compatible according to this page.
  • Bart Leeuwen van
    Sun, Jul 16, 2017, 3:35 AM
    I would like to give the manager-role the capability to perform this plugin.
    In my site the function is only available to the admin.
    How can the capabilities be set?
  • Frankle Lee 李智高
    Thu, Nov 23, 2017, 1:52 PM
    Great help for administrator! Can this work on 3.3?
  • Ricardo Caiado
    Fri, May 18, 2018, 6:19 AM

    Any updates to Moodle 3.5?

  • Alexander Bias
    Mon, Jun 25, 2018, 5:44 PM
    I can confirm that the plugin is working on 3.5 for us, however I am also wondering if the plugin maintainer has stopped working on it.
  • Steffen Bachmann
    Wed, Jan 16, 2019, 2:11 PM
    Hallo, as far as i understood the docs, there is only the possibility to assign global rols. In future will be there a possibility to assign rols on category level?
    That would be really great!
  • Flemming Bornemann
    Tue, Aug 27, 2019, 7:32 PM
    Hi Paul,
    Thanks for a great plugin smile

    Is there any chance you could extend this plugin so that cohorts could be assigned roles in categories?
  • Charles Beadle
    Thu, Oct 1, 2020, 3:27 AM
    If cohort sync is enabled and in use, would the cohort role synchronization plugin conflict with it? I'm looking for a way to add a role to all members of an existing cohort, but I'm wondering if this plugin would conflict with cohort sync.
  • Anthony M
    Fri, Dec 31, 2021, 10:02 AM
    I have been testing and when I "Define a new synchronization" all the users in an existing cohort are assigned the system rol as expected.

    But from that moment if I add a new user to the cohort that new user is not added to the system role anymore. I am using "Profile field based cohort membership" to add the users to the cohort.

    I just wanted to check if the above behaviour is expected or if there is something wrong in my tests?
  • Anthony M
    Fri, Dec 31, 2021, 4:50 PM
    Even if my cohort has now a new user (added by the plugin "Profile field based cohort membership") when the scheduled task runs in Moodle it´s not Syncing the user to the system role...

    Execute scheduled task: Sincronizar asignaciones de roles de cohorte (tool_cohortroles\task\cohort_role_sync)
    ... started 09:29:02. Current memory use 32.9MB.
    Sync cohort roles...
    Added 0
    Removed 0
    ... used 3 dbqueries
    ... used 0.0045390129089355 seconds
    Scheduled task complete: Sincronizar asignaciones de roles de cohorte (tool_cohortroles\task\cohort_role_sync)

    Any feedback in the compatibility of local_cohortrole with the plugin "Profile field based cohort membership" would be appreciated?
  • Stephan Domanowski
    Thu, Aug 18, 2022, 10:03 PM
    Hi Paul, I could use the plugin for one of my problems.
    I need to map a global group to a specific system role in individual course areas.
    The plugin currently only works system-wide.
    Are there any plans to further develop the plugin in this direction?
    Greetings Stephan
  • Sheri Gunville
    Tue, Mar 26, 2024, 11:57 AM
    I am having Anthony M's exact problem 3 years later...any resolution with having cohort role synchronization work with profile field based cohort membership?
    I have the role 'student' assigned to the cohort 'abc' and upon creation, all the existing cohort members became students...success! However when a new user registers and becomes a member of the cohort via profile field based cohort membership, they do not get the role sync to 'student' and the sync cohort roles is running. I'm stumped.
1 2
Please login to post comments