Moodle 4.4 developer update
This page highlights the important changes that are coming in Moodle 4.4 for developers.
Enrolment
Support for multiple instances in csv course upload
It is now possible to upload a CSV file with multiple enrol instances of the same type in same course. This is useful for example when you want to enrol users in a course using two different cohorts.
To support this, a new method has been added to allow the UI to locate existing enrolment instances:
/**
* Finds matching instances for a given course.
*
* @param array $enrolmentdata enrolment data.
* @param int $courseid Course ID.
* @return stdClass|null Matching instance
*/
public function find_instance(
array $enrolmentdata,
int $courseid,
) : ?stdClass;
If your enrolment plugins supports multiple instances within the same course, you should implement this method.