Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-6722

course creators can not restore courses

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.6.3
    • 1.6.1, 1.6.2
    • Backup
    • None
    • all
    • Any
    • MOODLE_16_STABLE
    • MOODLE_16_STABLE

      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); }

      }

            stronk7 Eloy Lafuente (stronk7)
            rosiva Kurt Rosivatz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.