Cohort external database sync not working

Cohort external database sync not working

by koen roggemans -
Number of replies: 1
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators

Hi all,

I've set up a Moodle 3.7 test server with cohort external database

The external database contains id, username, firstname, lastname, cohort and email for 2 new users (not existing in the moodle test server). Everything installed on localhost.

example data:

id,gebtuikersnaam,voornaam,achternaam,email,klas
"1","1900001","karel","de grote","karel.degrote@ritacollege.be","1la"
"2","1900002","napoleon","bonaparte","napoleon.bonaparte@ritacollege.be","1la"

The configuration settings for the plugin are:

"1794","tool_cohortdatabase","version","2018061101"
"1795","tool_cohortdatabase","dbtype","mysqli"
"1796","tool_cohortdatabase","dbhost","localhost"
"1797","tool_cohortdatabase","dbuser","root"
"1798","tool_cohortdatabase","dbpass","banaan"
"1799","tool_cohortdatabase","dbname","school"
"1800","tool_cohortdatabase","dbencoding","utf-8"
"1801","tool_cohortdatabase","dbsetupsql",
"1802","tool_cohortdatabase","dbsybasequoting","0"
"1803","tool_cohortdatabase","debugdb","0"
"1804","tool_cohortdatabase","minrecords","1"
"1805","tool_cohortdatabase","localuserfield","idnumber"
"1806","tool_cohortdatabase","remotecohorttable","sitegroepen"
"1807","tool_cohortdatabase","remoteuserfield","inschrijvingsnummer"
"1808","tool_cohortdatabase","remotecohortidfield","klas"
"1809","tool_cohortdatabase","remotecohortnamefield","klas"
"1810","tool_cohortdatabase","remotecohortdescfield",
"1811","tool_cohortdatabase","removeaction","0"
"1812","tool_cohortdatabase","createusers","1"
"1813","tool_cohortdatabase","createusers_username","inschrijvingsnummer"
"1814","tool_cohortdatabase","createusers_email","email"
"1815","tool_cohortdatabase","createusers_firstname","voornaam"
"1816","tool_cohortdatabase","createusers_lastname","achternaam"
"1817","tool_cohortdatabase","createusers_idnumber","inschrijvingsnummer"
"1818","tool_cohortdatabase","createusers_auth","manual"

But users don't get created and the cohort "1la" is created twice.

Using "inschrijvingsnummer" for users username and ID-number is intentional.

It would be great to get this working. I'm happy to write some documentation and example source database layout for the plugin if I manage to get it going smile. Does anyone see my mistake?

Average of ratings: Useful (1)
In reply to koen roggemans

Re: Cohort external database sync not working

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
I found it: I had a typo in a field name of my external database. I found it by ticking the debug database box and running the task from cli. For future reference: on command line go to /moodle/admin/tool/cohortdatabase/cli and execute: php sync.php

I started some documentation on https://docs.moodle.org/37/en/Cohort_external_database
Average of ratings: Useful (2)