Hi all,
I am developing on Moodle4.5 and trying to create a custom block plugin to call Moodle's course reset function.
However, it fails when calling course_module_bulk_update_calendar_events() in /lib/moodlelib.php and stops there.
No error occurred when resetting the quiz from the Moodle interface using the standard method.
Is there an error in the way I am invoking the course reset process from my custom plugin?
Moodle version: 4.5.3
PHP version: 8.3
・/blocks/myplugin/xxx.php (my custom plugin)
:
// set data
$data = unserialize ( base64_decode ( $status ['data'] ) );
$data->reset_start_date_old = 0;
$data->id = $queue->courseid;
// course reset
$queue_result = reset_course_userdata ( $data );
・/lib/moodlelib.php
function reset_course_userdata($data) {
:
// Update calendar events for all modules.
course_module_bulk_update_calendar_events($modname, $data->courseid); // fail to call function
・/course/lib.php
function course_module_bulk_update_calendar_events($modulename, $courseid = 0) {
Thanks in advance,
Teruaki Ichihara