Moodle Plugins directory: Enrol users with CSV | Moodle.org
Enrol users with CSV
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.
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
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()
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()
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);
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?
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
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
return array('course' => true);
}
it is displayed now
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 !
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?