mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
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
This commit is contained in:
parent
5690e088fc
commit
6972c07a61
1 changed files with 7 additions and 0 deletions
|
@ -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');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue