Fail to call function course_module_bulk_update_calendar_events()

Fail to call function course_module_bulk_update_calendar_events()

بواسطة - Teruaki Ichihara
عدد الردود: 2

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) {

    global $DB;
        :

Thanks in advance,
Teruaki Ichihara

متوسط التقييمات: -
رداً على Teruaki Ichihara

Fail to call function course_module_bulk_update_calendar_events()

بواسطة - Thom Rawson
صورة Moodle HQ صورة Particularly helpful Moodlers
Hello Teruaki,

You might have better luck posting this question in the Developer's area just down the page in this Moodle in English course.
 
Edit: I've moved your post to the Developers area.
 
In addition, some resources can be found in the online Developer documentation.