Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-12402

Student cannot unenrol self via button on profile page

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 1.8.2
    • Course
    • None
    • Doesn't matter
    • MySQL
    • MOODLE_18_STABLE

      moodle/role:unassignself has been allowed for students so students can unenrol from any course.

      It works when student clicks on the link in administration field on course view page. However, when trying to unenrol via the button on profile page an error message appears. Apparently student must have moodle/role:assign allowed

      Reason for bug:
      if ($userid) on line 31 of file course/unenrol.php always evaluates to true when the script is called via the button on profile page. So the script thinks someone else is about to be unenrolled.

      Fix of bug:
      Replacing

      if ($userid) {

      by

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

      on lines 31, 42, and 66 in file course/unenrol.php fixes the bug.

            poltawski Dan Poltawski
            chessweb Ralf Seliger (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.