Moodle
  1. Moodle
  2. MDL-27603

enrol_user not setting modifierid due to code defect

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.3
    • Fix Version/s: 2.0.4
    • Component/s: Enrolments
    • Labels:
    • Database:
      Any
    • Testing Instructions:
      Hide

      1. Log in as teacher.
      2. Select a course (Navigation -> "My Courses" -> "XYZCOURSE")
      3. Go to enrolled users list (Settings -> users -> "Enrolled users")
      3. Enroll a new student
      4. Check "user_enrollments" table and make sure the last record has modifierid > 0
      (SQL: SELECT modifierid FROM mdl_user_enrolments ORDER BY timemodified DESC LIMIT 1

      NOTE: Change table name if it has prefix other then "mdl_"

      Show
      1. Log in as teacher. 2. Select a course (Navigation -> "My Courses" -> "XYZCOURSE") 3. Go to enrolled users list (Settings -> users -> "Enrolled users") 3. Enroll a new student 4. Check "user_enrollments" table and make sure the last record has modifierid > 0 (SQL: SELECT modifierid FROM mdl_user_enrolments ORDER BY timemodified DESC LIMIT 1 NOTE: Change table name if it has prefix other then "mdl_"
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Pull Master Branch:
      wip-mdl-27603-master
    • Rank:
      17268

      Description

      I noticed that the modifierid in the user_enrolments table was almost always zero. Found that enrol_user (in lib/enrollib.php) is attempting to set "modifier" rather than "modifierid" in two places. Should be a simple fix.

        Activity

        Hide
        Sam Hemelryk added a comment -

        Looks good to me thanks Rejesh - however you need to be careful with the variable alignment. In both lines changed I see the values were aligned to begin with but not after being changes.

        Show
        Sam Hemelryk added a comment - Looks good to me thanks Rejesh - however you need to be careful with the variable alignment. In both lines changed I see the values were aligned to begin with but not after being changes.
        Hide
        Sam Hemelryk added a comment -

        Thanks Rajesh - this has been integrated now

        Show
        Sam Hemelryk added a comment - Thanks Rajesh - this has been integrated now
        Hide
        Michael de Raadt added a comment -

        The modifierid field is set to the userid of the teacher doing the enrolling action.

        Bingo!

        Show
        Michael de Raadt added a comment - The modifierid field is set to the userid of the teacher doing the enrolling action. Bingo!
        Hide
        Eloy Lafuente (stronk7) added a comment -

        This is now part of upstream. Many thanks!

        Show
        Eloy Lafuente (stronk7) added a comment - This is now part of upstream. Many thanks!

          People

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

            Dates

            • Created:
              Updated:
              Resolved: