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:
146 sites
40 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
    गुरु, 31 मार्च 2022, 4:31 AM
    Thank you for the response Dan. I saw the csv option in the drive list and had hoped it was a file.
  • Dan Marsden
    गुरु, 31 मार्च 2022, 5:17 AM
    I haven't used the adodb CSV connnector before - not sure if it works, but you could give it a go - it might be ok - just sounds extremely fragile.
  • Otaku Dude
    शुक्र, 1 अप्रैल 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
    सोम, 4 अप्रैल 2022, 6:58 AM
    @Otaku - yes. Probably best that you try it out and see if it meets your needs. मुस्कान
  • Otaku Dude
    शुक्र, 13 मई 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
    सोम, 16 मई 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
    सोम, 16 मई 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
    मंगल, 17 मई 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
    मंगल, 17 मई 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
    मंगल, 17 मई 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
    मंगल, 30 अग॰ 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
    बुध, 31 अग॰ 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! मुस्कान
  • Simon Lewis
    गुरु, 16 मार्च 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
    शुक्र, 17 मार्च 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
    रवि, 23 फ़र॰ 2025, 12:07 AM
    Is there any moodle 4.5+ update?
1 2
Please login to post comments