Steps I completed to synch moodle with an external DB for account creation and enrollment.
1 - figure out what was being asked for first.
Bottom line. I needed to synch 2 moodle processes, account creation and course enrollment, to an existing external DB. The big one, two. I found the native moodle functionality and enabled two scripts that cause moodle to pull data from the external DB and compare to itself and possibly create accounts and enrollment.Details.
2 - figure out what i was doing
I spent a bit of time working out in my head what I was doing. Big picture stuff. It's how my brain works. These are helpful moodle docs. External DB authentication. and External database enrollment.I spent a bit of time in the forms listed in bottom of each moodle doc page.
3 - Enabling Authentication and Enrollment synching in Moodle
a - Account authentication
Site administration | Plugins | Authentication| External database
b - Enrollment synching
Site administration | Plugins | Enrollments | External database
4 - Activating two scripts
For me in a Windows environment, I wanted to call the php files from the command line. So I verified how to call php files from the Windows command line and added the call to both of the scripts from the same Windows file. I called the file sych_with_moodle.bat. Its contains look like thisREM Part 1 - synch the users (Authentication)
c:\wamp\bin\php\php5.3.13\php.exe -f c:\wamp\www\student\auth\db\cli\sync_users.php -a
REM PART 2 - synch the enrollments
c:\wamp\bin\php\php5.3.13\php.exe -f c:\wamp\www\student\enrol\database\cli\sync.php -a
5 - Calling the scripts, automatically using cron script
I am using the native moodle cron script, moodlesite/admin/cron.php, to call the sych_with_moodle.bat file. I added this line to the bottom of the cron.php script to call the .bat file.system("cmd /c c:/wamp/www/sych_with_moodle.bat");
great post - thanks
ReplyDelete