Moodle Plugins directory: Child course | Moodle.org
Child course
Child course
mod_childcourse adds a Moodle activity that works as a shortcut inside a parent course. When clicked, the user is redirected to a child course and (optionally) the plugin performs automatic enrolment, group mapping, and incremental synchronization of completion and grades.

What the plugin solves (in practice)
Moodle can link courses in many ways, but most solutions become fragile when you need controlled access, consistent group mapping, and reliable tracking. This module adds the missing layer: enrolment rules + stateful synchronization inside a single activity.
- Supports Backup/Restore.
- Can hide the child course from "My courses / Overview" to reduce clutter.
- On delete, choose whether to unenrol link-enrolled users or keep enrolments.
How it works
The module stores configuration in the instance table and tracks the operational mapping/state in dedicated tables. On access, it optionally enrols and maps groups, then redirects the user. Synchronization runs on schedule (and can be forced manually).
- User opens "Child course" activity.
- If enabled: enrolment is performed (role preserved if configured).
- Optional: group mapping (fixed group or inherited groups).
- Redirect to the child course (same tab or new tab).
- Manual sync action (when the user has permission) for immediate incremental sync.
- Manage instances via a course management page (requires
moodle/course:update). - Index page listing all instances inside the course.
view.php— main activity page (student redirects; teacher sees a dashboard)manage.php— lists/manages instances in the courseindex.php— lists module instances in the course
Activity completion rules
When Moodle completion is set to Automatic, the activity can mark itself complete using additional rules based on the child course.
enablecompletion = 1 for completion-based rules to work.Synchronization (grades and completion)
Synchronization is designed to be incremental. Instead of recalculating everything, the plugin tracks state and updates only what changed.
\mod_childcourse\task\sync_task runs by default every 15 minutes (see db/tasks.php) and performs incremental synchronization for all instances.- Useful after configuration changes.
- Useful for debugging or support.
- Does not require waiting for cron schedule.
Mobile support (Moodle App)
In the Moodle App, the activity renders a simple screen with a single button to open the child course. Clicking it performs the same enrolment + access flow as the web version.
Data structure (tables)
The plugin uses dedicated tables to keep configuration clean and synchronization scalable.
{childcourse}{childcourse_map}{childcourse_state}Support
- Moodle version
- Steps to reproduce
- Which activity instance (parent course + child course IDs)
- Whether auto-enrol / groups / role-preserve were enabled
- Cron / task logs (if it’s about sync)
- Enable auto-enrol when you want a "one-click access" experience.
- Use group mapping to keep cohorts consistent across parent/child courses.
- Prefer incremental sync for large sites (avoid manual full sync habits).
- Test completion rules on a staging site before rolling to production.
- No core modifications.
- Single activity UX inside the parent course.
Comments