This script allow you to fill existing cohorts with existing users from a csv file.
Works in 2.1
- Make a dir : moodle/cron/
- In the dir, paste fill_cohorts.php file and username-cohort-utf8.csv file (with yout users)
1st colone : username
2d colone : Cohort ID
- Only existing cohort will be filled
- Only existing user will be enroled
- Play it one time (http://yourmoodle/cron/fill_cohorts.php) or make a cron job to do it regulary
- Later, if you change your username-cohort-utf8.csv file, the cron will do the job
Save your data before !
Test it with 1 or 2 users for the begining...
Working on my server with cron and 1200 users, take 5 seconds...
Does your file uploaduser.php include Eric's code?
Are cohorts assigned thru fields in the users CSV file? I assume the fieldname is 'cohort'.
Thanks in advance
Can I use this file in moodle 2.0 ? If not, can you tell me what needs to be changed?
Did you ever get an answer? Also running 2.0 here.
I need to update users form cohort1 to cohort2
Example: I have user1 he is member of cohort1 and I want to change his cohort from cohort1 to cohort2 with csv files. So when importing a csv file, it should remove all existing cohorts and add the new cohorts.
Is that possible?