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

Manually assigning a role in a course does not record timestart and timeend values for courses with enrollment durations

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.1
    • Fix Version/s: 2.0
    • Component/s: Roles / Access
    • Labels:
      None
    • Environment:
      PHP 4.4.6 and MySQL 5.0.27 running on Linux/Apache
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      To reproduce:
      1. Enter a course that has an enrollment duration specified in its settings.
      2. Click "Assign Roles" in the Administration panel.
      3. Click "Student" under Roles.
      4. Select a student in the "potential users" pane on the right and click the left-arrow button to assign that user as a student in the course.
      5. Check (using something like phpMyAdmin) the new entry in mdl_role_assignments. Its "timestart" and "timeend" values will each be "0".

      A quick and dirty fix:
      In the file admin/roles/assign.php, add the following two lines of code around line 142 (in 1.8.1):
      $timestart = time();
      $timeend = time() + $course->enrolperiod;
      I am not a Moodle developer and am not familiar with the intricacies and dependencies of the code in this file, so this should be used with caution. Hopefully a real Moodle developer can check into it.

      A final observation:
      At the top of admin/roles/assign.php is a series of parameter checks. This includes $timestart and $timeend, although apparently these do not actually do anything (since timestart and timeend have to be defined manually, as in the code above, to have any values). Having said that, there is a typo in line 19:
      $timeend = optional_param('timened', 0, PARAM_INT);
      Should be:
      $timeend = optional_param('timeend', 0, PARAM_INT);

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              skodak Petr Skoda
              Reporter:
              sunsetonline Rob Hindman
              Tester:
              Nobody Nobody
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                24/Nov/10