General plugins (Local): CSV Enrolls & Groups plugin
The CSV Enrolls & Groups plugin allows you to import user enrollments for a course from an uploaded delimited text file. It is contributed by Fred Woolard.
Enrollments are made with the manual enrol plugin and using a selectable role. The plugin can optionally create course groups and assign the new enrollees to those groups.
Each of the users listed in the input file must have an existing Moodle user account; new Moodle user accounts will not be created.
This plugin was originally (Moodle 1.9) a refactor of the mass_enroll course admin mod done by Patrick Pollet and Valery Fremaux, using the standard groups course import plugin as a template. The current Moodle 2.x revision is again a refactor, but as a local plugin (placed into the local/ directory off the Moodle root), and accessed from the course administration menu under the 'Users' node.
Besides being able to create groups, you can select from existing groups and override the data file's group designation.
// Choose the regex pattern based on the $ident_field
switch($ident_field)
{
case 'email':
$regex_pattern = '/^"?\s*([a-z0-9][\w.%-]*@[a-z0-9][a-z0-9.-]{0,61}[a-z0-9]\.[a-z]{2,6})\s*"?(?:\s*[;,\t]\s*"?\s*([a-z0-9][\w\' .,&-\[\]\{\}\(\)]*))?\s*"?$/Ui';
break;
//case 'idnumber':
// $regex_pattern = '/^"?\s*(\d{1,32})\s*"?(?:\s*[;,\t]\s*"?\s*([a-z0-9][\w\' .,&-\[\]\{\}\(\)]*))?\s*"?$/Ui';
// break;
default:
$regex_pattern = '/^"?\s*([a-z0-9][\w@.-]*)\s*"?(?:\s*[;,\t]\s*"?\s*([a-z0-9][\w\' .,&-\[\]\{\}\(\)]*))?\s*"?$/Ui';
break;
}
I apologize for the difficulty. As I look at this, I should have made the idnumber field validation more flexible, rather than specific to our environment. I will make a change to the plugin at some point in the near future.
Regards,
FW
@Fred, thank you very much!
Where am i can find header a template for upload users with group?
username1,GroupA
username2,GroupA
username3,GroupB
Username4,GroupC
...
...
username1,GroupA
username2,GroupA
username3,GroupB
username4,GroupC
...
...
Set 'Assign to group' to 'Yes' (puts users in groups), 'Use group' to 'User file data' (use group specified in the import file) and 'Create group' to 'Yes' (create a group if it does not already exist)
please i have a question: We would like every teacher/manager to have the opportunity to upload a list of participants as a CSV file on your course.
Best regards
Is it possible by using this plugin - prohibited new group creation during the CSV import? User with enrolment right can not create a new group but only can added users to that group where is enroled.
Thanks
Mojmir