]> git.mjollnir.org Git - moodle.git/commitdiff
Merged unenrol fixes from stable MDL-6964 MDL-7123
authormoodler <moodler>
Mon, 23 Oct 2006 03:12:37 +0000 (03:12 +0000)
committermoodler <moodler>
Mon, 23 Oct 2006 03:12:37 +0000 (03:12 +0000)
course/unenrol.php

index ba15e4545f3f2b896df8c375e04a363959d54e8c..e007e88cc39d39bad27e2b464e260d5ae992eb18 100644 (file)
     }
 
     if ($confirm and confirm_sesskey()) {
-
         if ($userid) {
             if (! role_unassign(0, $userid, 0, $context->id)) {
                 error("An error occurred while trying to unenrol that person.");
             }
+
+            add_to_log($course->id, 'course', 'unenrol', "view.php?id=$course->id", $userid);
+            redirect($CFG->wwwroot.'/user/index.php?id='.$course->id);
+
         } else {
             if (! role_unassign(0, $USER->id, 0, $context->id)) {
                 error("An error occurred while trying to unenrol you.");
             }
-        }
-
-        add_to_log($course->id, 'course', 'unenrol', "view.php?id=$course->id", $USER->id);
+            add_to_log($course->id, 'course', 'unenrol', "view.php?id=$course->id", $USER->id);
 
-        redirect($CFG->wwwroot.'/user/index.php?id='.$course->id);
+            redirect($CFG->wwwroot);
+        }
     }