Lately I've been developing some code that allows for teachers to add students to their course. I'm also developing several other tweaks and customizations for moodle, that I plan to post at a later date. I've made the decision that the current "Student Adder" code is clean enough and 'mature' enough to be released to those of you who wish to use it. Right now I have only coded it to handle "manual" enrollments, but have plans to write in support for an external MySQL dB (which is what we plan to use).
Here's how it works:
- Teacher navigates to the student button on the admin sidebar
- Student adder asks how many new students need to be added.
- It then displays a series of textboxes, and name input is in the following format: "Richie<SPACE>Foreman"
- The data from the text boxes is parsed and then usernames are added to the moodle system in the following format: (rforeman, rforeman1, rforeman3). Also, a password is generated for the user in the following format: ((username)(3digit random number)).Then, the newly created user is enrolled in the current course. Lastly, the page echoes out all the new usernames and passwords.
Here's how to install:
Open up moodle/course/student.php
Near the bottom you'll notice this code:
print_simple_box_start("center");
$sesskey = !empty($USER->id) ? $USER->sesskey : '';
include('student.html');
print_simple_box_end();
Right above that add these following lines:
print_simple_box_start("center");
$inmoodle = 1;
include_once('studentadder.php');
print_simple_box_end();
Drop the attached file into moodle/course/ directory.
Thanks,
Richie Foreman
Mesa Public Schools, Mesa Arizona.