Error at bulk adding activities to more than one course

Error at bulk adding activities to more than one course

by Daniel Palomino -
Number of replies: 0

Hi, I'm new at this and hoping this is in the right thread. 

I'm getting at error when I'm trying to bulk upload activities from a plugin and I don't know why. The error that throws me is the following:

Cache definition core/coursemodinfo requires simple keys. Invalid key provided.

I'm using a modification of the modedit.php file, it recieves a parameter that indicates if the upload of information is a bulk or not and then creates the activity (or activities), the plugin is WizIQ and it helps to create virtual classrooms inside moodle, the bulk form of the plugin takes information from a comma separated string like this: test1(class),test1(description),1527285993(schedule),50(duration),14971(teacher id),10046 (course id). 

But the problem becomes with the course id; when I try to add only one class it let me add without problems but when I try to add more than one with different course id's then is when the problem begins and throws me the error.

I don't know what to do.

Here I change the Id's in every upload (the $tdata[5] is where I save the course id):

$data->course=$tdata[5];

$fromform->course=$tdata[5];

$course->id=$tdata[5];

unset($mform->course);

and then I use this function to finally upload the data:

$fromform = add_moduleinfo($data, $course, $mform);



Please help!

Average of ratings: -