Moodle

Unenroll from user profile doesn't work properly

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.8.3, 1.9
  • Fix Version/s: 1.8.4, 1.9, 2.0
  • Component/s: Enrolments
  • Labels:
    None
  • Database:
    Any
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

Description

Perhaps this applies too to 1.9 and 1.7. To reproduce in 1.8:

1. Enrol a user in a course with unassignself capability enabled
2. Impersonate the student or login as such student
3. Go to his/her personal profile
4. Click in the "Unenrol me from XXX" button

You get a "Sorry, but you do not currently have permissions to do that (Assign roles to users)" message.

This problem can be resolved by modifying user/view.php or by modifying course/unenrol.php. I've attached a patch for 1.8.1+ that applies the former solution. I you can review...

Thanks in advance

Issue Links

Activity

Hide
Katarzyna Potocka added a comment -

if i've seen correctly it is also possible, to add in ../course/unenrol.php in line ~30 following things:
old version:
if ($userid) {

new version:
if ($userid && $userid!=$USER->id) {

this checks if you want to unenrol yourself -> ok that's possible, if you want to unenrol somebody else, than you will get a "Sorry, but you .....".

Show
Katarzyna Potocka added a comment - if i've seen correctly it is also possible, to add in ../course/unenrol.php in line ~30 following things: old version: if ($userid) { new version: if ($userid && $userid!=$USER->id) { this checks if you want to unenrol yourself -> ok that's possible, if you want to unenrol somebody else, than you will get a "Sorry, but you .....".
Hide
Nicolas Martignoni added a comment -

This is confirmed on 1.8.3.

Show
Nicolas Martignoni added a comment - This is confirmed on 1.8.3.
Hide
Nicolas Martignoni added a comment -

Confirmed in 1.9beta2 too.

Show
Nicolas Martignoni added a comment - Confirmed in 1.9beta2 too.
Hide
Nicolas Martignoni added a comment - - edited

The link "Unenrol me from course" in course administration block works though! (both in 1.8.3 and 1.9beta2).

Show
Nicolas Martignoni added a comment - - edited The link "Unenrol me from course" in course administration block works though! (both in 1.8.3 and 1.9beta2).
Hide
Dan Poltawski added a comment -

Hi, Thanks for the report. I've fixed this in a slightly different way to the patch as other things are depending on $userid (the language used for confirmation for example).

Should be fixed in cvs.

Show
Dan Poltawski added a comment - Hi, Thanks for the report. I've fixed this in a slightly different way to the patch as other things are depending on $userid (the language used for confirmation for example). Should be fixed in cvs.
Hide
Nicolas Martignoni added a comment -

Verified on 1.9beta3. Closing. Thanks and merry Xmas

Show
Nicolas Martignoni added a comment - Verified on 1.9beta3. Closing. Thanks and merry Xmas

Dates

  • Created:
    Updated:
    Resolved: