Moodle plugins directory: CSV Enrolls & Groups plugin

Use this local plugin to import user enrollments and group assignments from a delimited text file into the course. New user accounts will not be created, so each of the users listed in the input file must already have an account set up in the site. It also provides a way to make group assignments based on meta-course enrollments.

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. An additional feature allows instructors to make group assignments based on meta-course enrollments.

Comments

Fred - Many thanks for sharing this plugin with the Moodle community. I have installed and looked at the plugin and it looks good. I did not test it with an actual CSV file but I am presuming that part of things works fine. If not, folks can file issues in the tracker. When you get a chance, I would encourage you to add a page to Moodle Docs and then provide that URL under the Useful links section. Please do not hesitate to let me know if there is anything I can do to be supportive of your efforts. Peace - Anthony

We are needing something like this, but at other contexts (a block?), that allow import enrollments, like your plugin, for multiple pre-selected courses...
I know about the upload users method, but it needs an administrator rol.

Carina, I understand your problem, and yes, building such a plugin would be viable. It could be a block, sited on the 'my' page, displayed only for users who have an instructor role. And that's something to consider for a future incarnation.

Frederic, thank you for the suggestion to change the regex validation; using single character group names should be perfectly valid. I do not believe your change will create any undesirable side effects. The change appears to only remove the restriction that group names begin with a letter or number, i.e it will allow underscores (_) as first letter.

I will likely keep the restriction that group names begin with a letter or number, but will make changes to allow the single char group names.

Hi Fred, would this plugin work for ONLY adding users to a group via CSV? We have users already enrolled in a course, but we need a way to group students and remove students from a group quickly and efficiently. Would this plugin be a viable option?

Marc, there's likely a character I did not correctly account for in the email address. The regex pattern used for emails is:
$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';

You test that pattern against your input file, or if you need help with that, you can message/email a sample email address entry from your file.