Invalid enrol context

Invalid enrol context

- Zoran Jančić の投稿
返信数: 2
画像 Particularly helpful Moodlers

I found great little function for enrolling User to a course here: https://moodle.org/mod/forum/discuss.php?d=266496

The problem is, I'm keep getting "invalid enrol instance" error message at the following line:

$enrol->enrol_user($instance, $userid, $roleid);

Stack trace is the following:

invalid enrol instance!' in enrollib.php:1641
enrol_plugin->enrol_user(Object(stdClass), '192', '5')
check_enrol('TT001', '192', '5', 'manual')

Moodle version is 3.3

Zoran Jančić への返信

Re: Invalid enrol context

- Darko Miletić の投稿

That error means that you tried to enrol user using one enrollment plugin with instance created by another enrollment plugin.