diff --git a/backup/restorelib.php b/backup/restorelib.php index a3121c14171..64d75d1406e 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -3684,6 +3684,10 @@ define('RESTORE_GROUPS_GROUPINGS', 3); } else { $sca->userid = $USER->id; } + // If course scale, recode the course field + if ($sca->courseid != 0) { + $sca->courseid = $restore->course_id; + } // If scale is standard, if user lacks perms to manage standar scales // 'downgrade' them to course scales if ($sca->courseid == 0 and !has_capability('moodle/course:managescales', get_context_instance(CONTEXT_SYSTEM), $sca->userid)) {