Skip to main content

Batch Enrollment

Goal: Automatically enroll students and lecturers from the semester database created by elearning_dashboard into Moodle courses for the new semester.

Context

  • External database: elearning_dashboard (configured in semester settings)
  • Course table: course_{platformname}_{semester}
  • Enrollment table: enrollment_{platformname}_{semester}
  • Moodle plugin: enrol_database (External database enrollment)

Step-by-Step

  1. Confirm Semester Configuration in elearning_dashboard
    • Log in to elearning_dashboard.
    • Open the current semester settings.
    • Verify that the tables course_{platformname}_{semester} and enrollment_{platformname}_{semester} exist for the new semester.
    • Check that course shortnames, idnumbers, and user mappings are correct.
  2. Access Moodle Admin
    • Log in to the target semester’s Moodle site as an administrator.
    • Navigate to Site administration → Plugins → Enrolments → Manage enrol plugins.
    • Ensure External database is enabled and positioned correctly in the enrollment method list.
  3. Configure External Database Plugin
    • Go to Site administration → Plugins → Enrolments → External database.
    • Set the following values:
      • Database host: IP or hostname of elearning_dashboard DB server.
      • Database name: elearning_dashboard
      • Database user/password: Credentials with read access to the above DB.
      • Database table for enrolments: enrollment_{platformname}_{semester}
      • Database table for courses: course_{platformname}_{semester} (if auto course creation is enabled)
      • Local course field: idnumber
      • Remote course field: course_idnumber
      • Local user field: username or idnumber (match the data in the enrollment table)
      • Remote user field: username (or match local choice)
      • Default role: Student (will be overridden if role mapping is set)
    • Enable role mapping if you store role names in the enrollment table, mapping:
      • student → Student role ID
      • editingteacher → Teacher (editing) role ID
      • teacher or noneditingteacher → Teacher or Non-editing Teacher role ID
  4. Run Enrollment Sync
    • The External Database plugin runs via Moodle’s scheduled tasks.
    • To run manually, execute:
      php /moodleweb/moodle/{platformname}_{semester}/admin/cli/scheduled_task.php --execute=\\enrol_database\\task\\sync_enrolments
    • Check Site administration → Server → Scheduled tasks to confirm that Synchronise enrolments task is enabled and runs regularly.
  5. Verify Enrollments
    • Open a sample course in Moodle.
    • Go to Participants and verify that the correct students and lecturers are enrolled with the correct roles.

Checklist Before Marking Complete

  • Semester tables exist in elearning_dashboard and contain correct data.
  • External database plugin in Moodle is enabled and pointing to the correct tables.
  • Role mapping is correct.
  • Enrollment sync runs without errors.
  • Spot-check confirms correct enrollments in sample courses.