If the user isn't admin and the restored course hasn't teachers, add teacher.
Bug 2381 (http://moodle.org/bugs/bug.php?op=show&bugid=2381) Merged from MOODLE_14_STABLE
This commit is contained in:
@@ -333,6 +333,7 @@
|
||||
//Now if all is OK, update:
|
||||
// - course modinfo field
|
||||
// - categories table
|
||||
// - add user as teacher
|
||||
if ($status) {
|
||||
echo "</li><li>".get_string("checkingcourse").'</li>';
|
||||
//modinfo field
|
||||
@@ -340,6 +341,13 @@
|
||||
//categories table
|
||||
$course = get_record("course","id",$restore->course_id);
|
||||
fix_course_sortorder();
|
||||
//Make the user a teacher if the course hasn't teachers (bug 2381)
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Cleanup temps (files and db)
|
||||
|
||||
Reference in New Issue
Block a user