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

Data/view.php - move $PAGE->set_url before require_course_login() to support usertours

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Minor
    • None
    • 3.1
    • User Tours
    • MOODLE_31_STABLE

    Description

      Not sure which one should "bend" a little, but when installing local/usertours I am getting the following errors:

      This page did not call $PAGE->set_url(...). 
      Using http://ourmoodlesite/mod/data/view.php?d=89
      line 565 of /lib/pagelib.php: call to debugging()
      line 773 of /lib/pagelib.php: call to moodle_page->magic_get_url()
      line 507 of /local/usertours/classes/manager.php: call to moodle_page->__get()
      line 460 of /local/usertours/classes/helper.php: call to local_usertours\manager::get_current_tour()
      line 61 of /local/usertours/lib.php: call to local_usertours\helper::bootstrap()
      line 1303 of /lib/navigationlib.php: call to local_usertours_extend_navigation()
      line 2747 of /lib/navigationlib.php: call to global_navigation->initialise()
      line 451 of /course/format/singleactivity/lib.php: call to global_navigation->find()
      line 1049 of /lib/pagelib.php: call to format_singleactivity->page_set_cm()
      line 2640 of /lib/moodlelib.php: call to moodle_page->set_cm()
      line 2975 of /lib/moodlelib.php: call to require_login()
      line 101 of /mod/data/view.php: call to require_course_login
      

      To "fix" this in Moodle, as I was not sure local/usertours was using the proper way of hooking into Moodle, I moved the following code before the require_course_login() function:

      $urlparams = array('d' => $data->id);
          if ($record) {
              $urlparams['rid'] = $record->id;
          }
          if ($page) {
              $urlparams['page'] = $page;
          }
          if ($mode) {
              $urlparams['mode'] = $mode;
          }
          if ($filter) {
              $urlparams['filter'] = $filter;
          }
          // Initialize $PAGE, compute blocks
          $PAGE->set_url('/mod/data/view.php', $urlparams);
      

      Which solved this issue, without any noticeable drawback.
      Is it correct?
      Or should we ask the usertours developer to "fix" their plugin?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              nadavkav Nadav Kavalerchik
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Clockify

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.