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

bug in unenrol_student

    XMLWordPrintable

    Details

    • Database:
      Any
    • Affected Branches:
      MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      The function unenrol_student in lib/deprecated.php calls the role_unassign function and passes a context object, however, the role_unassign function expects a context id. This bug results in users not being unenroled from a course. The following fix seems to work for me:

      Change this line:
      role_unassign($role->id, $userid, 0, $context) and $status;

      To this:
      role_unassign($role->id, $userid, 0, $context->id) and $status;

      It appears this bug affects versions 1.7 and greater

        Attachments

          Activity

            People

            Assignee:
            dougiamas Martin Dougiamas
            Reporter:
            imrook Jason Noble
            Tester:
            Nobody
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              30/Mar/07