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

Going to assignment grading page for courses that don't yet have students creates a php warning with patch

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9, 2.0
    • Component/s: Assignment (2.2)
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      In a course that does not have students assigned to it, if one goes to the assignment grading page, one gets a php warning (requires warning level to be elevated – a common setting during initial testing).

      It is caused by calling array_keys on $users which is not defined.

      To fix, change in mod\assignment\lib.php

      $users = get_users_by_capability($context, 'mod/assignment:submit', '', '', '', '', $currentgroup, '', false)
      $users = array_keys($users);

      to

      if($users = get_users_by_capability($context, 'mod/assignment:submit', '', '', '', '', $currentgroup, '', false))

      { $users = array_keys($users); }

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                3/Mar/08