Skip to content

Course Prerequisites

Prerequisites let you require a student to finish one or more other courses before they can enrol in this one. It is how you enforce a learning order instead of letting students jump straight to the advanced material.

  • Require one or several other courses to be completed before a student can enrol in this course.
  • Block enrollment for any student who has not finished all of the required courses.
  • Show the required courses on the course page as links, so a student can discover and take them first.
  • Leave prerequisites empty to keep a course open to everyone.

Course Prerequisites first view

Edit the course and open the Prerequisites, Difficulty & Target section of the course editor. The prerequisite picker appears when you are editing an existing course and there is at least one other course to choose from.

Use the search box to filter the course list, then tick each course a student must complete first. You can select as many as you need. The course you are editing is never shown in its own list.

Save the course. Prerequisites are stored as a list of course IDs on the course.

On the course page, the required courses render under a Prerequisites heading as links, so a student can go take them. When a student tries to enrol, Learnomy checks that they hold a completed enrollment for every required course. If any is missing or only in progress, enrollment is refused with a message to complete the prerequisites first.

  • Completed, not just enrolled. A prerequisite is satisfied only by a completed enrollment. An active (in-progress) enrollment in a required course does not unlock the target course.
  • All required courses must pass. Every course in the list must be completed; there is no “any one of” mode.
  • Enforced everywhere. The prerequisite check runs at the service layer, so it applies to REST, admin, and CLI enrollment paths alike, not just the front-end Enrol button.
  • Empty means open. A course with no prerequisites is open to everyone (subject to its pricing and access model).

Service (Learnomy\Services\Course_Service):

  • check_prerequisites( $user_id, $course_id ) – returns true when the user holds a completed enrollment for every prerequisite course, or the course has none. Called from Enrollment_Service::enroll() before any enrollment row is created; a failed check makes enroll() return 0.

Storage: lrn_courses.prerequisites holds a JSON array of course IDs. The courses REST controller accepts a prerequisites array on create/update and stores it as JSON.

REST: POST to the enrollments endpoint returns a validation error (“You must complete the required prerequisite courses first.”) when prerequisites are unmet.