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

modifiedby and timemodified not set during questions import

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.9.13, 2.0.4, 2.1.1, 2.2
    • 1.9.14, 2.0.5, 2.1.2
    • Questions
    • MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE
    • Hide

      Fix :
      just add the 2 missing lines :
      $question->modifiedby = $USER->id;
      $question->timemodified = time();

      Show
      Fix : just add the 2 missing lines : $question->modifiedby = $USER->id; $question->timemodified = time();
    • Hide

      Use any format to import some questions. No need to look at the database, just go to the question bank page, imported question don't display any name for the "last modification by" column

      Show
      Use any format to import some questions. No need to look at the database, just go to the question bank page, imported question don't display any name for the "last modification by" column

    Description

      As the title says the modifiedby and timemodified fields of the question table are not set during questions import.
      This affect all imports and all Moodle versions since at least 1.9 (I have not looked in previous versions)
      This is because of the code

                  $question->createdby = $USER->id;
                  $question->timecreated = time();
       
                  if (!$question->id = insert_record("question", $question)) {
                      error( get_string('cannotinsert','quiz') );
                  }

      in Moodle 1.9
      and

                  $question->createdby = $USER->id;
                  $question->timecreated = time();
       
                  $question->id = $DB->insert_record('question', $question);

      in Moodle 2.0/2.1
      this code is in the function importprocess of the question/format.php
      lines 395-398 for Moodle 2.1
      lines 349-352 for Moodle 2.0
      lines 325-330 for Moodle 1.9
      I guess this is so minor that nobody ever noticed it. And it doesn't break anything I think !

      Attachments

        Activity

          People

            timhunt Tim Hunt
            jmvedrine Jean-Michel Vedrine
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Michael de Raadt Michael de Raadt
            Safat Shahin, Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10/Oct/11