Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.7, 1.9
    • Fix Version/s: 1.7.2, 1.8, 1.9
    • Component/s: Enrolments
    • Labels:
      None
    • Environment:
      Bug exists in 1.7 (which we're running) and also is in cvs HEAD
    • Database:
      Any
    • Affected Branches:
      MOODLE_17_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      In /enrol/database/enrol.php, line 100 and following:

      foreach($existing as $key => $role_assignment) {
      if ($role_assignment->roleid = $role->id
      && $role_assignment->contextid = $context->id) {

      Should instead be:

      foreach($existing as $key => $role_assignment) {
      if ($role_assignment->roleid == $role->id
      && $role_assignment->contextid == $context->id) {

      Thus, for every course, we get "User is already enroled" in that course. (ie, if we uncomment that error_log() call)

      Thus, no user will ever get auto-enroled in any course.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              rbowen Rich Bowen added a comment -

              Sorry. Line 110 and following, not line 100 and following. Although, I'm sure you could have determined that.

              — enrol.php.orig 2007-02-28 11:29:30.000000000 -0500
              +++ enrol.php 2007-02-28 11:17:49.000000000 -0500
              @@ -108,8 +108,8 @@
              // already has this role in this context. If it is, we
              // skip to the next course.
              foreach($existing as $key => $role_assignment) {

              • if ($role_assignment->roleid = $role->id
              • && $role_assignment->contextid = $context->id) {
                + if ($role_assignment->roleid == $role->id
                + && $role_assignment->contextid == $context->id) {
                unset($existing[$key]);
                //error_log('[ENROL_DB] User is already enroled in course '.$course->idnumber);
                continue 2;
              Show
              rbowen Rich Bowen added a comment - Sorry. Line 110 and following, not line 100 and following. Although, I'm sure you could have determined that. — enrol.php.orig 2007-02-28 11:29:30.000000000 -0500 +++ enrol.php 2007-02-28 11:17:49.000000000 -0500 @@ -108,8 +108,8 @@ // already has this role in this context. If it is, we // skip to the next course. foreach($existing as $key => $role_assignment) { if ($role_assignment->roleid = $role->id && $role_assignment->contextid = $context->id) { + if ($role_assignment->roleid == $role->id + && $role_assignment->contextid == $context->id) { unset($existing [$key] ); //error_log(' [ENROL_DB] User is already enroled in course '.$course->idnumber); continue 2;
              Hide
              dougiamas Martin Dougiamas added a comment -

              Great, Rich, thanks!

              --> Nicolas (1.7 1.8 and head),

              Show
              dougiamas Martin Dougiamas added a comment - Great, Rich, thanks! --> Nicolas (1.7 1.8 and head),
              Hide
              nicolasconnault Nicolas Connault added a comment -

              Fixed typos in 17, 18 and HEAD

              Show
              nicolasconnault Nicolas Connault added a comment - Fixed typos in 17, 18 and HEAD

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

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