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

Teacher error on resources/activities with 2+ activity completion in restrict access

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Test 1: Repeat tests from MDL-48804

      Test 2:

      1. Enable conditional access
      2. Create a module with two or more access restrictions
      3. As a teacher view the course and the module, make sure there are no errors
      4. As a student view the course, make sure there are no errors
      5. As a student try to directly access URL of the module, make sure the appropriate error string is displayed and you are redirected to the course page (there may be some debugging messages there unrelated to this issue)
      Show
      Test 1: Repeat tests from MDL-48804 Test 2: Enable conditional access Create a module with two or more access restrictions As a teacher view the course and the module, make sure there are no errors As a student view the course, make sure there are no errors As a student try to directly access URL of the module, make sure the appropriate error string is displayed and you are redirected to the course page (there may be some debugging messages there unrelated to this issue)
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull Master Branch:
      wip-MDL-49418-master

      Description

      If a teacher create a resource/activity and add 2+ restrict access -> activity completion the teacher will see an error
      For admins or students everything works fine

      How to replicate this problem on a fresh moodle 2.7.5+ (Build: 20150305):
      1. enable "Enable conditional access" underr Site administration -> Advanced features
      2. enable "Enable completion tracking" under Site administration -> Advanced features
      3. create a course and enrol students/teachers (enable completion tracking)
      4. login as the teacher account
      5. upload file1 and file2
      6. add a new file and in restrict access add activity completion on file1
      7. save and display -> everything works
      8. edit file and in restrict access add activity completion on file2
      9. save and display -> error

      This is the error:
      Coding error detected, it must be fixed by a programmer: The theme has already been set up for this page ready for output. Therefore, you can no longer change the theme, or anything that might affect what the current theme is, for example, the course.

      Debug info: Stack trace when the theme was set up: <ul style="text-align: left" data-rel="backtrace"><li>line 637 of /lib/pagelib.php: call to moodle_page->initialise_theme_and_output()</li><li>line 812 of /lib/pagelib.php: call to moodle_page->magic_get_theme()</li><li>line 507 of /availability/classes/tree.php: call to moodle_page->get_renderer()</li><li>line 416 of /availability/classes/tree.php: call to core_availability\tree->get_full_information_recursive()</li><li>line 216 of /availability/classes/info.php: call to core_availability\tree->get_result_information()</li><li>line 1780 of /lib/modinfolib.php: call to core_availability\info->is_available()</li><li>line 1807 of /lib/modinfolib.php: call to cm_info->obtain_dynamic_data()</li><li>line 1176 of /lib/modinfolib.php: call to cm_info->get_user_visible()</li><li>line 3144 of /lib/moodlelib.php: call to cm_info->__get()</li><li>line 3292 of /lib/moodlelib.php: call to require_login()</li><li>line 51 of /mod/resource/view.php: call to require_course_login()</li></ul>
      Error code: codingerror

      Stack trace:
      line 1832 of /lib/pagelib.php: coding_exception thrown
      line 914 of /lib/pagelib.php: call to moodle_page->ensure_theme_not_set()
      line 1002 of /lib/pagelib.php: call to moodle_page->set_course()
      line 3158 of /lib/moodlelib.php: call to moodle_page->set_cm()
      line 3292 of /lib/moodlelib.php: call to require_login()
      line 51 of /mod/resource/view.php: call to require_course_login()

      Output buffer: <div class="notifytiny debuggingmessage" data-rel="debugging">Coding problem: $PAGE->context was not set. You may have forgotten to call require_login() or $PAGE->set_context(). The page may not display correctly as a result<ul style="text-align: left" data-rel="backtrace"><li>line 453 of /lib/pagelib.php: call to debugging()</li><li>line 1502 of /lib/pagelib.php: call to moodle_page->magic_get_context()</li><li>line 637 of /lib/pagelib.php: call to moodle_page->initialise_theme_and_output()</li><li>line 812 of /lib/pagelib.php: call to moodle_page->magic_get_theme()</li><li>line 507 of /availability/classes/tree.php: call to moodle_page->get_renderer()</li><li>line 416 of /availability/classes/tree.php: call to core_availability\tree->get_full_information_recursive()</li><li>line 216 of /availability/classes/info.php: call to core_availability\tree->get_result_information()</li><li>line 1780 of /lib/modinfolib.php: call to core_availability\info->is_available()</li><li>line 1807 of /lib/modinfolib.php: call to cm_info->obtain_dynamic_data()</li><li>line 1176 of /lib/modinfolib.php: call to cm_info->get_user_visible()</li><li>line 3144 of /lib/moodlelib.php: call to cm_info->__get()</li><li>line 3292 of /lib/moodlelib.php: call to require_login()</li><li>line 51 of /mod/resource/view.php: call to require_course_login()</li></ul></div>

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Mar/15