So I want to automatically reset a course. I know .. moosh... (I think that is what is called can do it). However, I did not want to rely on a 3rd party program because I was worried I would not be able to install it on a live server. After searching through the different sources I was able to come up with what I think reset_course_userdata(...) is expecting as a parameter. However, when I plug it in I get: "Can not find data record in database table course."
I have verified my course ID is 2 and I have manually found it through mysql so I know it is in the table "mdl_course".
1st) any ideas what I may be doing wrong. (This is sandbox code so please excuse the mess).
2nd) Is there an easier way of resetting a course without involving human interaction?
$START_D_A = explode('/',$START_TIME);
$END_D_A = explode('/',$END_TIME);
echo "The course id is ".$COURSEID;
$data = array(
'id' => $COURSEID,
'reset_events' => '1',
'reset_notes' => '1',
'reset_gradebook_items' => '1',
'reset_quiz_attempts' => '1',
reset_course_userdata($data); //error thrown on this line
Thank you very much.
I had to do a var dump to see how the object was formed but that did the trick. Thanks!