]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10241 - unenrolling self wasn't working properly from user profile
authorpoltawski <poltawski>
Sun, 23 Dec 2007 16:18:25 +0000 (16:18 +0000)
committerpoltawski <poltawski>
Sun, 23 Dec 2007 16:18:25 +0000 (16:18 +0000)
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

index 4c29c73a1f029190bd0e4cfa61bde524f23cbc78..640357e21e2ae554891342f0aa0012f4ceae6e18 100644 (file)
     $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');
     }