From a6f39157c6f1a7a64ca1b413763502d8cf792b0b Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 23 Oct 2006 03:12:37 +0000 Subject: [PATCH] Merged unenrol fixes from stable MDL-6964 MDL-7123 --- course/unenrol.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/course/unenrol.php b/course/unenrol.php index ba15e4545f..e007e88cc3 100644 --- a/course/unenrol.php +++ b/course/unenrol.php @@ -39,20 +39,22 @@ } 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); + } } -- 2.39.5