Your Moodle version

General plugins (Local): Mass enrolments

Maintained by Picture of Rogier van Dongen Rogier van Dongen
A tool to all teachers to enrol existing users to their courses using CSV files (without bothering theit admins)

One awkward thing about Moodle 1.x and the recent Moodle 2.x is that teachers are allowed to manually enroll known Moodle accounts to a course as teachers, non editing teachers, students... , but not using a 'flat file' produced by some CSV export.

They have to send a file to an admin user who will inject it into Moodle using the standard 'flatfile enrollment' method with the following limitations :

  • Teachers must provide account's and course idnumbers and admin user must reformat the file by adding the required extra columns 'add' and 'target role', before copying the file to the appropriate location in moodledata directory.
  • The report information is sent to admin, not to the course's teacher; so admin has to forward it to the teacher after the cron job has completed.
  • There is no way in flatfile enrollment method to specify in which groups these accounts should be added, so teacher has to go manually again across the list to assign accounts to groups.

This little extension, that adds itself to course administration menu will hopefully help teachers to do it themselves.

After installing it  a new item 'Bulk enrolments' will appear in the course administration menu for teachers (see screenshots).

It requires a CSV file, prepared by the teacher, with an unique Moodle id in the first column (idnumber, username or email) and optionally a group name in the second column. The first line of the CSV file must be present but its content is currently ignored.

Options are provided to force group (and grouping) autocreation if they do not yet exist in the target course.

Every line of the file may contain a different group name or even no group for some accounts


Screenshot #0


Picture of Rogier van Dongen
Rogier van Dongen (Lead maintainer)
Picture of Patrick Pollet
Patrick Pollet: Original author
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Ayokanmi Seun
    Mon, May 6, 2013, 3:07 AM
    Hi, Patrick am running moodle 2.4.3 and i download your plugin but when i login as a teacher on my moodle site i can see the plugin there, what can i do
  • Picture of Carina Martinez
    Thu, Jun 6, 2013, 10:39 PM
    Hi Patrick, thanks for this usefull plugin.
    Have you think an alternative, for site context, which could enrol the same csv to multiple courses? smile

  • Picture of Patrick Pollet
    Fri, Jun 14, 2013, 6:35 PM
    Please note that a new version is available on github that do not require anymore to patch Moodle core code to have the extra menu items to appear in course setting menus.
  • Picture of Monica Franz
    Tue, Jul 23, 2013, 6:15 PM
    Hi Patrick,

    I installed this plugin to our Moodle 2.5 platform. The testing worked fine, the translation too, but after leaving the testing url and opening the course again, the adminblock doesn't show the new menu items.
    I added the line at the end of config.php for the feature set 1.
    Could somethin gone wrong as I upgraded Moodle to 2.5 and installed your plugin newly, instead of upgrading it from 1.9 as well?

  • Picture of Monica Franz
    Tue, Jul 23, 2013, 6:58 PM
    Hi Patrick,

    the capability local/mass_enroll:enrol seems not to be set when I switrch to non-testing. Could this be the reason why the menu items don't show up in the admin.block? If so how and where should one set this?

  • Picture of Patrick Pollet
    Wed, Jul 24, 2013, 12:25 AM

    In testing mode, ie by calling directly local/mass_enroll/mass_enroll.php the capabilty is also checked (see line 29 require_capability('local/mass_enroll:enrol', $context); thus
    if they are not set, you should get a fatal error .

    thus there is something else that prevents the two extra menus items to appear under Course admin/users ...
    but what ?
  • Picture of Monica Franz
    Wed, Jul 24, 2013, 4:25 PM
    Hi Patrick,

    I purged the cache and the menue items are back now!

    Thanks for migrating this great plugin/add on to Moodle 2.5!
  • Picture of Jo Matthews
    Fri, Jan 3, 2014, 12:29 AM
    Hi Patrick,
    I need to bulk unenrol students who have been enrolled via the ims enterprise plugin. It looks like I can just modify the code in lib.php in the function mass_unenroll and replace:
    $plugin = enrol_get_plugin('manual');
    $plugin = enrol_get_plugin('imsenterprise');
    $instance = $DB->get_record('enrol', array('courseid' => $course->id, 'enrol' => 'manual'));
    $instance = $DB->get_record('enrol', array('courseid' => $course->id, 'enrol' => 'imsenterprise'));

    This seemed to work but do you know of any issues this might cause?
    Many thanks

  • Picture of Patrick Pollet
    Fri, Jan 3, 2014, 7:17 PM

    It looks good to me if you do it in function mass_unenroll($cir, $course, $context, $data)

    But in that case I guess that you do not plan to use the 'mass enrol by CSV' feature since this is handled by imsenterprise ?

    Thus I would suggest to remove capability local/mass_enroll:enrol to teacher role and may be adjust some strings in local/mass_enroll/lang/en

    Season's greetings.
  • Picture of Joshua Holden
    Sun, Feb 9, 2014, 5:12 AM
    Hi, Patrick and everyone watching this!
    We've been very happy using the plug-in on Moodle 2.4, but now we're migrating to 2.6 and our sysadmins are balking at installing the plug-in since it isn't officially rated for 2.6. Has anyone tried it? Any problems?
  • Picture of Joshua Holden
    Sun, Feb 9, 2014, 5:13 AM
    P.S Thanks in advance!
  • Picture of Kai Yang Lim
    Thu, Mar 13, 2014, 11:00 AM
    Exactly what I need! Thank you. Using Moodle2.5.4.
  • Picture of Patrick Pollet
    Thu, Mar 13, 2014, 7:02 PM
    Still works under latest moodle 2.6. I must bave to figure out how to add 2.6 icon to download tab here.
  • Picture of Tom YC
    Mon, Jun 9, 2014, 8:52 PM

    I installed this on Moodle 2.7 today and I cannot get the links to appear under the Users menu. I have added the line to the config.php file. The plugin works if you manually put the URL in the address bar.
    Any ideas? Perhaps something has changed in 2.7. It works fine on 2.6
    Thanks in advance - a really good plugin by the way.

  • Picture of Ludovico Sassarini
    Tue, Sep 9, 2014, 6:08 PM
    Hi, just a quick info: does it work for moodle 2.7.1?
1 2
Please login to post comments