Cohort external database

Administration tools ::: tool_cohortdatabase
Maintained by Dan Marsden, Catalyst IT
This plugin creates site-level cohorts using a connection to an external database. (similar to enrol_database plugin but instead of creating enrolments it creates site-level cohorts.)
Latest release:
141 sites
37 downloads
28 fans
Current versions available: 3

This plugin creates site-level cohorts using a connection to an external database. 

  • Can be triggered via CLI and/or scheduled task.
  • Creates site-level cohorts
  • Syncronises users in cohorts
  • Optionally auto create users

Screenshots

Screenshot #0

Contributors

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

Comments RSS

Show comments
  • Otaku Dude
    che, 1 abr 2022, 4:48 PM
    Thank you @Dan, one last question if I may, if we can sort out a db connection, if a student is listed twice with 2 or more different cohort requirements, will the plugin create all cohorts?
  • Dan Marsden
    lun, 4 abr 2022, 6:58 AM
    @Otaku - yes. Probably best that you try it out and see if it meets your needs. smile
  • Otaku Dude
    che, 13 maj 2022, 6:40 PM
    Hiya @Dan we are now trialing the plugin. We have everything set up correctly I think, but we are not getting any cohorts created. I can ping between servers OK, so connection seems to be fine. We are using mssql and have use sybase quite enabled. I have set it to email admin with errors but I am not receiving anything. Is there any troubleshooting documentation, please.
  • Dan Marsden
    lun, 16 maj 2022, 11:30 AM
    @Otaku, Make sure cron is running and check the output of the cohortdatabase task - also try turning on $CFG->showcrondebugging = true; in your config.php to get more output in the cron task.
  • Otaku Dude
    lun, 16 maj 2022, 11:01 PM
    Thank you @Dan, I appreciate your time on this. The only error we see is in task_log table is:
    Starting cohort synchronisation...
    Error while communicating with external cohort database
    I'm not sure when the extra output in the cron task will be?
    Thanks, Nigel (Otaku).
  • Dan Marsden
    mar, 17 maj 2022, 5:05 AM
    @Nigel, that simply means that the adodb library in Moodle can't connect to your external db server - lots of different things that could cause this, (wrong password, firewall issue, missing drivers on the web server etc) but turn debugging on in your cron and it might give you more output.
  • Dan Marsden
    mar, 17 maj 2022, 5:15 AM
    Also @Nigel, hit the "Debug ADOdb connection to external database" checkbox on the cohortdatabase settings page too, along with the showcrondebugging setting you might get some other useful output.
  • Otaku Dude
    mar, 17 maj 2022, 11:55 PM
    Thank you @Dan, that seems to have produced something more useful - Missing extension for mssql. I will pass that on to our IT dept.
  • koen roggemans
    mar, 30 aus 2022, 2:44 PM
    Hi Dan, Is it possible to push the latest and greatest version of this plugin to the Moodle plugins database. The new cleanup function looks very cool. Thanks!
  • Dan Marsden
    mèr, 31 aus 2022, 6:54 AM
    @Koen - I finally got round to adding our github action config to the repo and it's triggered an auto-deploy to the plugins db now - thanks! smile
  • Simon Lewis
    giò, 16 mar 2023, 11:07 PM
    Hi Dan,
    Thanks for a great plugin! We use it a lot.

    I've found an issue with PHP 8.0. When running the scheduled task we get the error:
    odbc_free_result(): supplied resource is not a valid ODBC result resource
    I had the same error with one of our custom plugins, that also uses ODBC, so I managed to fix it I think.
    In classes/sync.php I've added $rs->Close(); to line 113, 267, 366. And that seems to fix the task.
    I'll look out for how you do it in an updated version, as you might well do it a different, better way (or there may be issues with how I've done it), but thought I'd report it here nonetheless.

    thanks a lot,
    Simon
  • Dan Marsden
    che, 17 mar 2023, 4:08 AM
    @Simon - nice catch - looks like a sensible change, feel free to submit a pull request so I can merge that into the main branch - thanks!
  • Ricardo Caiado
    dom, 23 fre 2025, 12:07 AM
    Is there any moodle 4.5+ update?
  • Al
    lun, 5 maj 2025, 7:10 AM
    Hi Dan
    Please can you change your supported version to moodle 4.5 or 5 so that when we install moodle each week, it auto installs, this would save a lot of time. Thank you.
  • Al
    lun, 19 maj 2025, 5:53 AM
    Hi Dan, sorry to nag, love your plugin, if you could just set the supported version of moodle to 4.5, it would save so much time on update, cheers mate.
1 2
Please login to post comments