Select Moodle version:

Blocks: Enrol users with CSV

block_csv_enrol
This block allows teachers to enrol users into a course by allowing a teacher to upload an csv file with only email addresses.
Maintained by: Picture of Ted van den Brink Ted van den Brink
for Moodle
2.1, 2.2, 2.3

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
screenshot

Contributors

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

Comments RSS

Show comments
  • Picture of Armando Oliveira
    Sun, Aug 19, 2012, 9:54 PM
    hi TEd can you give me a example of cvs format file.Thks.
  • Picture of Ted van den Brink
    Mon, Aug 27, 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
  • Picture of jun xia
    Fri, Aug 31, 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()
  • Picture of Steve Bailey
    Thu, Oct 4, 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?
  • Picture of Modestos Stavrakis
    Thu, Oct 18, 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()
  • Picture of Jean Yuen
    Mon, Oct 29, 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);



  • Picture of Ted van den Brink
    Tue, Oct 30, 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
    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
    Yes, I missed that I didn't have the CVS enrolment plugin open
  • My picture
    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
    Change to function applicable_formats() {
    return array('course' => true);
    }
    it is displayed now
  • Picture of John Anderson
    Tue, Apr 15, 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...
Please login to post comments