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

Student cannot unenrol self via button on profile page

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              poltawski Dan Poltawski
              chessweb Ralf Seliger
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: