Enrol users with CSV

Blocks ::: block_csv_enrol
Maintained by Ted van den Brink
This block allows teachers to enrol users into a course by allowing a teacher to upload an csv file with only email addresses.
Latest release:
41 sites
9 downloads
12 fans
Current versions available: 1

Block CSV Enrol

Description: This block allows teachers to enrol users into a course by allowing a teacher to upload an csv file with only email addresses. After running the upload you can download a txt file that contains a log of the enrolled and failed users.

License: GNU General Public License http://www.gnu.org/copyleft/gpl.html

Usage:

The admin user must add this block to the Moodle course page This block will only be visible for teachers.

Uploading a CSV: Upload a file using the Manage uploaded files button, After clicking this button the file manager appears. Upload the CSV file and click on save changes, wait for Moodle to process it, the CSV gets processed immidiately!

When done you will get a txt file with the log of the enrol results. [filename] = upload_[date]_[time]

[filename].csv : your uploaded CSV [filename].log : info on number of adresses processed etc.

Screenshots

Screenshot #0
Screenshot #1

Contributors

Ted van den Brink (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Ted van den Brink
    Mon, 27 Aug 2012, 3:28 PM
    Hi Armando,
    Sorry for the late response, I was away for vacation.
    The csv contents exists of 1 column, with only e-mail adresses.
    I've added an example in the bitbucket repository:
    https://bitbucket.org/tedvdb/csv_enrol/raw/ad9881ffee74/Example/Example.csv
  • jun xia
    Fri, 31 Aug 2012, 9:34 PM
    PHP catchable fatal error
    Debug info: Argument 2 passed to has_capability() must be an instance of context, null given, called in /moodle/blocks/csv_enrol/block_csv_enrol.php on line 46 and defined
    Stack trace:

    line 365 of /lib/setuplib.php: coding_exception thrown
    line 348 of /lib/accesslib.php: call to default_error_handler()
    line 46 of /blocks/csv_enrol/block_csv_enrol.php: call to has_capability()
    line 280 of /blocksblock.class.php: call to block_csv_enrol->get_content()
    line 232 of /blocksblock.class.php: call to block_base->formatted_contents()
    line 926 of /lib/blocklib.php: call to block_base->get_content_for_output()
    line 978 of /lib/blocklib.php: call to block_manager->create_block_contents()
    line 349 of /lib/blocklib.php: call to block_manager->ensure_content_created()
    line 7 of /theme/brick/layout/general.php: call to block_manager->region_has_content()
    line 686 of /lib/outputrenderers.php: call to include()
    line 638 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
    line ? of unknownfile: call to core_renderer->header()
    line 1363 of /lib/setuplib.php: call to call_user_func_array()
    line 145 of /user/index.php: call to bootstrap_renderer->__call()
    line 145 of /user/index.php: call to bootstrap_renderer->header()
  • Steve Bailey
    Thu, 4 Oct 2012, 10:23 PM
    Can you specify which role you are assigning? Also, can this be added at the category level to manage category enrolments?
  • Modestos Stavrakis
    Thu, 18 Oct 2012, 6:26 PM
    Throws an error that seems to be related to theme's call to block_manager.

    Debug info: Argument 2 passed to has_capability() must be an instance of context, boolean given, called in /home/moodle/public_html/blocks/csv_enrol/block_csv_enrol.php on line 46 and defined
    Error code: codingerror
    Stack trace:
    line 397 of /lib/setuplib.php: coding_exception thrown
    line 355 of /lib/accesslib.php: call to default_error_handler()
    line 46 of /blocks/csv_enrol/block_csv_enrol.php: call to has_capability()
    line 281 of /blocks/moodleblock.class.php: call to block_csv_enrol->get_content()
    line 232 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
    line 929 of /lib/blocklib.php: call to block_base->get_content_for_output()
    line 981 of /lib/blocklib.php: call to block_manager->create_block_contents()
    line 352 of /lib/blocklib.php: call to block_manager->ensure_content_created()
    line 7 of /theme/aegeanmod/layout/general.php: call to block_manager->region_has_content()
    line 765 of /lib/outputrenderers.php: call to include()
    line 712 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
    line 169 of /user/view.php: call to core_renderer->header()
  • Jean Yuen
    Mon, 29 Oct 2012, 11:49 PM
    I had the same error when access to the page: Participant (of a course):
    Debug info: Argument 2 passed to has_capability() must be an instance of context, boolean given, called in /home/moodle/public_html/blocks/csv_enrol/block_csv_enrol.php on line 46 and defined
    Error code: codingerror
    Stack trace:
    line 397 of /lib/setuplib.php: coding_exception thrown
    line 355 of /lib/accesslib.php: call to default_error_handler()
    line 46 of /blocks/csv_enrol/block_csv_enrol.php: call to has_capability()
    line 281 of /blocks/moodleblock.class.php: call to block_csv_enrol->get_content()
    line 232 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
    line 929 of /lib/blocklib.php: call to block_base->get_content_for_output()
    line 981 of /lib/blocklib.php: call to block_manager->create_block_contents()
    line 352 of /lib/blocklib.php: call to block_manager->ensure_content_created()
    line 7 of /theme/aegeanmod/layout/general.php: call to block_manager->region_has_content()
    line 765 of /lib/outputrenderers.php: call to include()
    line 712 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
    line 169 of /user/view.php: call to core_renderer->header()
    -------------
    and i tried to fix the code (sorry to author if you feel uncomfortable for what i did, but it's just a temporay way to avoid the fatal error)..
    If you are finding how to fix the error, here for you:
    In csv_enrol/block_csv_enrol.php:
    - at line 33, change the code to:
    $currentcontext = get_context_instance(CONTEXT_COURSE,$courseid);
    - after line 32, add this code:
    $courseid = optional_param('id', 0, PARAM_INT);



  • Ted van den Brink
    Tue, 30 Oct 2012, 12:45 AM
    @Steve the users are enrolled as students.

    I couldn't reproduce these errors, but have implemented a fix that could prevent these errors. Could you please test the new version (2012102901) and report back to me if this resolves the issues?
  • My picture
    Thu, 21 Feb 2013, 12:44 AM
    Hello,

    Thanks for share the block with the community. It is going to save us a lot of work enrolling students into courses.

    I have successfully installed in Moodle 2.2.4 and, when I got to 'Add block' in a course, I cannot see the block as an admin.

    Have I missed something ?

    Regard,
    Mari Cruz
  • My picture
    Thu, 21 Feb 2013, 12:48 AM
    Yes, I missed that I didn't have the CVS enrolment plugin open
  • My picture
    Thu, 21 Feb 2013, 12:55 AM
    I still cannot see the block after that, can you please advice?
    The block has been successfully installed (I see it in the list of blocks) and there is not a permission problem as I am using a WAMP test server in my laptop

    Thank you very much for your advise
  • My picture
    Thu, 21 Feb 2013, 1:04 AM
    Change to function applicable_formats() {
    return array('course' => true);
    }
    it is displayed now
  • John Anderson
    Tue, 15 Apr 2014, 12:52 AM
    Hi, I have this working ok in M2.4. One problem I am having is that I cannot 'select all' or send messages to the enrolled participants from the participants page. Other courses work fine in this regard. Any ideas? It worked great BTW...
  • Zabelle Motte
    Wed, 25 Nov 2015, 7:20 PM
    I have been testing on 2.9 and it seems to work fine.
    It seems only the log message to be "User already enrolled" while user is actually enrolled, and log message to be "User enrolled" when user is already enrolled.
    I have been testing for 3 times to be sure !
  • Thiago Henrique Ornelas Costa
    Wed, 15 Feb 2017, 5:08 AM
    Hey Ted ! Nice plugin! its possible add the option to use in csv the user identify date like the registration information instead the e-mail? because the email its mutable but the registration Id its a primary key! smile Again nice work in it! Ty
  • Thiago Henrique Ornelas Costa
    Thu, 16 Mar 2017, 3:42 AM
    well, i changed the lib code to use the username unstead the email and worked!!! now its easy to enrol the users in bulk! ! ty man soo mutch for this plugin!
  • Dietmar Grasböck
    Wed, 24 Jan 2018, 7:48 PM
    Hi, it seems that this plugin is not compatible with Moodle 3.3 and 'clean' theme.

    After the csv_enrol block has been used at a course, all blocks/text fields/activities/resources on the course cannot be edited anymore. The only solution was, to disable the plugin in the site administration.

    Has anyone an idea?

    @Developer: Is there a further development planned to fix issues with moodle 3.3/3.4?
1 2
Please login to post comments