Admin tools: Cohort auto roles management

tool_cohortautoroles
Maintained by Picture of Dan MarsdenDan Marsden, Picture of Catalyst ITCatalyst IT
This plugin is based on the core tool_cohortroles plugin and allows the selection of a role rather than an individual to assign a manager/mentor/parent to a user. If a user is assigned the selected role at any level - (site/course/category etc) they will be assigned as the mentor/manager/parent to all users within the cohorts selected they are also a member of.
40 sites
14 downloads
11 fans
Current versions available: 1

This plugin is based on the core tool_cohortroles plugin and allows the selection of a role rather than an individual to assign a manager/mentor/parent to a user.

If a user is assigned the selected role at any level - (site/course/category etc) they will be assigned as the mentor/manager/parent to all users within the cohorts selected they are also a member of.

Example:

  • Cohort "Engineering" has the users, "John, Mary, Steven, George"
  • Cohort "6th Floor" has the users "John, David, Simon"
  • John is enrolled in course 1 with the custom role "Support"
  • David is assigned the custom role "support" at the site-level.
  • A Parent/Mentor/manager role has been created in the system to allow user-level role assignments - see:https://docs.moodle.org/en/Parent_role
  • The cohortautoroles plugin is configured to find all users in the "support" role, assign them to the parent/manger/mentor role.

John will be automatically assigned as the mentor to "Mary, Steven, George, David, Simon" 
David will be automatically assigned as the mentor to "John, Simon"

NOTE: Mentors will only be assigned if they are also a member of the cohort as well.


Screenshots

Screenshot #0

Contributors

Picture of Dan Marsden
Dan Marsden (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Me!
    Tue, Oct 18, 2016, 1:47 PM
    Thanks Dan - I had a look at this plugin. The code seems very familiar smile. Even though it's based on my plugin the copyrights could be updated to you - we typically just assign them to the first person to commit each file. It would be nice to see some unit tests for this plugin and some more detail in the description (it took me reading the SQL to realise the mentor/manager/parent should also be in the cohort). While limiting this to system role assignments might be a nice feature - you can do that anyway by limiting the contexts that a custom role can be assigned - so I guess this gives you more flexibility.

    Thanks for uploading it here - I'm sure it will be useful in some cases (especially mentors etc). My +1 to approve this plugin.
  • Picture of Dan Marsden
    Wed, Oct 19, 2016, 4:01 AM
    Thanks Damyon,

    I had updated the copyright in the version.php but didn't touch the other files as they are really just copies of your files with some pretty minor modifications.
  • Picture of David Mudrák
    Mon, Oct 24, 2016, 4:13 AM

    Thanks Dan for sharing the plugin with the community, and thanks Damyon for the approval check. My apologies for the delay with the formal approval. I am happy to press the button now. You are cleared to land, welcome to the Plugins directory!

  • Picture of Jonathan Jensen
    Wed, Jun 19, 2019, 10:04 AM
    Thanks Dan.
    This was working beautifully on an older version
    I upgraded to 3.7 and now this.
    I see that the same problems were addressed for the original plugin that it was based on.

    This happens after assigning roles when coming back to admin/tool/cohortautoroles/index.php? (instead of the table of role assignments)

    Class 'tool_lp\external\cohort_summary_exporter' has been renamed for the autoloader and is now deprecated. Please use 'core_cohort\external\cohort_summary_exporter' instead.
    line 122 of /lib/classes/component.php: call to debugging()
    line ? of unknownfile: call to core_component::classloader()
    line 109 of /admin/tool/cohortautoroles/classes/output/cohort_role_assignments_table.php: call to spl_autoload_call()
    line 837 of /lib/tablelib.php: call to tool_cohortautoroles\output\cohort_role_assignments_table->col_cohortname()
    line 1533 of /lib/tablelib.php: call to flexible_table->format_row()
    line 1656 of /lib/tablelib.php: call to table_sql->build_table()
    line 89 of /admin/tool/cohortautoroles/index.php: call to table_sql->out()
    Coding error detected, it must be fixed by a programmer: Unexpected property theme

    More information about this error

    ×Debug info:
    Error code: codingerror
    ×Stack trace:
    line 145 of /lib/classes/external/exporter.php: coding_exception thrown
    line 110 of /admin/tool/cohortautoroles/classes/output/cohort_role_assignments_table.php: call to core\external\exporter->export()
    line 837 of /lib/tablelib.php: call to tool_cohortautoroles\output\cohort_role_assignments_table->col_cohortname()
    line 1533 of /lib/tablelib.php: call to flexible_table->format_row()
    line 1656 of /lib/tablelib.php: call to table_sql->build_table()
    line 89 of /admin/tool/cohortautoroles/index.php: call to table_sql->out()
  • Picture of Dan Marsden
    Wed, Jun 19, 2019, 10:39 AM
    Please report issues to the bug tracker (link above under useful links) - pull requests are also welcome - thanks!
Please login to post comments