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

Wrong Last access within a course when the user had never access that course

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7.2
    • Fix Version/s: 1.8.4, 1.9, 2.0
    • Component/s: Course
    • Labels:
      None
    • Affected Branches:
      MOODLE_17_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      When we check within a course the profile of a user who had never access that course we get a wrong 'Last access'. Instead of 'Never', the last access into the course, we get the last access into the site.

      We find a solution modifying the source code in moodle/user/view.php
      In the original code
      if ($course->id != SITEID) {
      if ($lastaccess = get_record('user_lastaccess', 'userid', $user->id, 'courseid', $course->id))

      { $user->lastaccess = $lastaccess->timeaccess; }
      }
      We add a line to take into account when the user never access the course.
      if ($course->id != SITEID) {
      $user->lastaccess = false;
      if ($lastaccess = get_record('user_lastaccess', 'userid', $user->id, 'courseid', $course->id)) { $user->lastaccess = $lastaccess->timeaccess; }

      }

      We test the solution on a 1.7.2 moodle with a 8.2.4 postgres installed in a SUSE Linux Enterprise Server 10 SP1; and a 1.7.2 moodle with a 4.1.22 mysql installed in a SUSE LINUX Enterprise Server 9

        Attachments

          Activity

            People

            • Assignee:
              skodak Petr Skoda
              Reporter:
              yordonez Yolanda Ordoñez Rufat
              Tester:
              Nobody
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Jan/08