I took the existing code of /admin/uploaduser.php and uploaduser_form.php and enahnced it to create also new courses.
The code is called when you click on the link in Admin->Users->Accounts->Upload users. After Installation of my code you will find a new entry there with a link to uploadusersandcourses.php
- In the first pass the uploaded file is parsed for new courses to upload/create.
- In the second pass, the original code gets executed as it was to create new users and/or enrol existing ones.
Could an experienced moodle programmer have a look at it also to judge whether this code could be used to replace the existing uploaduser.php?
You will find a readme file in the zip file with installation instructions.
I included also a revised help file and needed language files.
In debug modus I found a minor php-notice if course1, course2, etc. are present in the first line of the csv file, but without valid data. So I corrected this issue.
NOTE: I have planned also to engineer this code down to make script out of it which could be run as an unattended cron-job, i.e. without going through the mentioned Admin->GUI
Rosario