Moodle
  1. Moodle
  2. MDL-14395

Upgrading to roles loses timestart and timeend from user_students and user_teacher tables

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Duplicate
    • Affects Version/s: 1.7.3, 1.7.4, 1.8, 1.9
    • Fix Version/s: 1.7.5, 1.8.6, 1.9.1
    • Component/s: Enrolments
    • Labels:
      None
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
    • Rank:
      31031

      Description

      I have courses where people are allowed to enroll for 180 days. After upgrading from 1.6.5 to 1.73, all information about when they enrolled was lost, along with the dates that they were supposed to be unenrolled. All this information was replaced with 0 in the database.

        Issue Links

          Activity

          Hide
          N Hansen added a comment -

          This sounds similar so I thought I would link it in case it has some bearing on solving this one.

          Show
          N Hansen added a comment - This sounds similar so I thought I would link it in case it has some bearing on solving this one.
          Hide
          N Hansen added a comment -

          In addition, I have tried adding a new student manually to the course. Now, no information is added about when the student was enrolled, or when they will be unenrolled. It still is 0 and shows up as unlimited!

          Show
          N Hansen added a comment - In addition, I have tried adding a new student manually to the course. Now, no information is added about when the student was enrolled, or when they will be unenrolled. It still is 0 and shows up as unlimited!
          Hide
          Martin Dougiamas added a comment -

          Hmm, whoah, yes they are lost!

          lib/accesslib.php

          /// Upgrade students.
          if (in_array($CFG->prefix.'user_students', $dbtables)) {
          if ($rs = get_recordset('user_students')) {
          while ($student = rs_fetch_next_record($rs))

          { // populate the user_lastaccess table $access = new object; $access->timeaccess = $student->timeaccess; $access->userid = $student->userid; $access->courseid = $student->course; insert_record('user_lastaccess', $access); // assign the default student role $coursecontext = get_context_instance(CONTEXT_COURSE, $student->course); role_assign($studentrole, $student->userid, 0, $coursecontext->id); $progresscount++; print_progress($progresscount, $totalcount, 5, 1, 'Processing role assignments'); }

          rs_close($rs);
          }
          }

          Show
          Martin Dougiamas added a comment - Hmm, whoah, yes they are lost! lib/accesslib.php /// Upgrade students. if (in_array($CFG->prefix.'user_students', $dbtables)) { if ($rs = get_recordset('user_students')) { while ($student = rs_fetch_next_record($rs)) { // populate the user_lastaccess table $access = new object; $access->timeaccess = $student->timeaccess; $access->userid = $student->userid; $access->courseid = $student->course; insert_record('user_lastaccess', $access); // assign the default student role $coursecontext = get_context_instance(CONTEXT_COURSE, $student->course); role_assign($studentrole, $student->userid, 0, $coursecontext->id); $progresscount++; print_progress($progresscount, $totalcount, 5, 1, 'Processing role assignments'); } rs_close($rs); } }
          Hide
          Martin Dougiamas added a comment -

          Petr can you please look into this please?

          Show
          Martin Dougiamas added a comment - Petr can you please look into this please?
          Hide
          Martin Dougiamas added a comment -

          Ah, just saw MDL-11142.

          Show
          Martin Dougiamas added a comment - Ah, just saw MDL-11142 .

            People

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

              Dates

              • Created:
                Updated:
                Resolved: