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

course creators can not restore courses

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.1, 1.6.2
    • Fix Version/s: 1.6.3
    • Component/s: Backup
    • Labels:
      None
    • Environment:
      all
    • Database:
      Any
    • Affected Branches:
      MOODLE_16_STABLE
    • Fixed Branches:
      MOODLE_16_STABLE

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

      }

        Attachments

          Activity

            People

            Assignee:
            stronk7 Eloy Lafuente (stronk7)
            Reporter:
            rosiva Kurt Rosivatz
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              10/Oct/06