Moodle

course creators can not restore courses

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major 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); }
}

Activity

Hide
Eloy Lafuente (stronk7) added a comment -

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

Show
Eloy Lafuente (stronk7) added a comment - 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

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: