From 6972c07a61c374fc3782da7be5f97df5abb1fbba Mon Sep 17 00:00:00 2001 From: poltawski Date: Sun, 23 Dec 2007 16:18:25 +0000 Subject: [PATCH] MDL-10241 - unenrolling self wasn't working properly from user profile because unenrol.php was doing wrong capability check when $userid set.o Also improves the lanaguage used when unenrolling self. merged from MOODLE_18_STABLE --- course/unenrol.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/course/unenrol.php b/course/unenrol.php index 4c29c73a1f..640357e21e 100644 --- a/course/unenrol.php +++ b/course/unenrol.php @@ -14,6 +14,13 @@ $userid = optional_param('user', 0, PARAM_INT); //course $confirm = optional_param('confirm', 0, PARAM_BOOL); + if($userid == $USER->id){ + // the rest of this code assumes $userid=0 means + // you are unassigning yourself, so set this for the + // correct capabiliy checks & language later + $userid = 0; + } + if (! $course = get_record('course', 'id', $id) ) { error('Invalid course id'); } -- 2.39.5