Details
Description
Course Creators cannot restore a course in Moodle 1.6.1 and 1.6.2+ up to 2006-09-27.
The restore process fails, because the course creator cannot be assigned as teacher to the newly created/restored course.
Reason:
Line 5347 and folllowing in restorelib.php:
if (!isadmin()) {
if (!$checktea = get_records('user_teachers','course', $restore->course_id)) {
//Add the teacher to the course
$status = add_teacher($USER->id, $restore->course_id);
}
}
The Variable $USER is not declared as global in the function restore_execute, so add_teacher is called with an empty user-id.
Suggested Solution: add global $USER to funtion, for example:
if (!isadmin()) {
if (!$checktea = get_records('user_teachers','course', $restore->course_id)) {
//Add the teacher to the course
global $USER;
$status = add_teacher($USER->id, $restore->course_id);
}
}
Activity
- All
- Comments
- History
- Activity
- Source
- Test Sessions
Hi Kurt,
if I'm not wrong this was solved by
MDL-6084, so I close it now, ok? If there is some problems with this, feel free to reopen the track.Thanks and ciao, Eloy
MDL-6084, so I close it now, ok? If there is some problems with this, feel free to reopen the track. Thanks and ciao, Eloy