Facebook    Twitter    Linked In    Google+

Moodle 2.0 Auto Upload Courses

I searched the internet for weeks looking for an easy way to auto upload courses from a .csv file to Moodle 2.0, 2.1, 2.2, 2.3. Until I finally stumbled onto some code that sort of worked. I then made some adjustments of my own and have a fully functinal .csv auto course upload. I have provided both the code, .csv file, and instructions below.

Instructions

Download the files below.
Place the uploadcourse.php file in your moodle/admin directory.
Next open and edit the uploadcourse.php file.
Change line 90,91 to appropriate MySQL connection information
Next edit line 652 to match where you will save your .csv file ($filename=”$CFG->dataroot/uploadcourse.csv”;)
Save uploadcourse.php
Place the uploadcourse.csv in the directory you specified above.
Next login as admin to your moodle instance and run the script. (example: moodle.timgeiger.com/admin/uploadcourse.php)
Thats it, if everything works correctly the script should create both courses and the categories associated with the .csv file

Things to remember

I update my .csv file nightly with a dump from our database to the .csv file.
If you would like to automate the script set up a cron job or Windows Scheduled Task to execute it daily.

Download
autouploadcourse

TG – Web Development © 2017