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

1.7+ Front Page Settings Not Sticking - admin > settings.php - and Temporary fix

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.7.1, 1.8
    • 1.7
    • Administration
    • None
    • WAMP
    • MySQL
    • MOODLE_17_STABLE
    • MOODLE_17_STABLE, MOODLE_18_STABLE

      When changing the front page settings, none of the selections "stick"... I have not checked to see if they are actually being written to the database as I am new to Moodle and don't know which table they are stored in yet.

      However, I have found the problem code section, it is related to the "slashes" changes. And the temporary fix is to comment out the slashes with an older version of the code section before the change. Once this is done it works fine again. However, I do not know if this creates any security issues.

      This appears to be a problem that many others are having when looking through the forums...

      admin > settings.php near line 54

      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      /// WRITING SUBMITTED DATA (IF ANY) -------------------------------------------------------------------------------

      $statusmsg = '';

      // Problems with the following code section. The slashes functions are not working correctly
      /*
      if ($data = data_submitted()) {
      if (confirm_sesskey()) {
      $olddbsessions = !empty($CFG->dbsessions);
      $unslashed = array();
      foreach($data as $key=>$value)

      { $unslashed[$key] = stripslashes($value); }

      $errors = $root->write_settings($unslashed);
      //force logout if dbsession setting changes
      if ($olddbsessions != !empty($CFG->dbsessions))

      { require_logout(); }
      if (empty($errors)) {
      switch ($return) { case 'site': redirect("$CFG->wwwroot/"); case 'admin': redirect("$CFG->wwwroot/$CFG->admin/"); default: $statusmsg = get_string('changessaved'); }
      } else { $statusmsg = get_string('errorwithsettings', 'admin') . ' <br />' . $errors; }
      } else { error(get_string('confirmsesskeybad', 'error')); }
      // now update $SITE - it might have been changed
      $SITE = get_record('course', 'id', $SITE->id);
      $COURSE = clone($SITE);
      }
      */

      // Replaced with OLD Code section that is working

      if ($data = data_submitted()) {
      if (confirm_sesskey()) {
      $olddbsessions = !empty($CFG->dbsessions);
      $errors = $root->write_settings((array)$data);
      //force logout if dbsession setting changes
      if ($olddbsessions != !empty($CFG->dbsessions)) { require_logout(); }

      if (empty($errors)) {
      switch ($return)

      { case 'site': redirect("$CFG->wwwroot/"); case 'admin': redirect("$CFG->wwwroot/$CFG->admin/"); default: $statusmsg = get_string('changessaved'); }

      } else

      { $statusmsg = get_string('errorwithsettings', 'admin') . ' <br />' . $errors; }

      } else

      { error(get_string('confirmsesskeybad', 'error')); }

      // now update $SITE - it might have been changed
      $SITE = get_record('course', 'id', $SITE->id);
      $COURSE = clone($SITE);
      }

      // E N D R E P L A C E M E N T - THIS IS THE NEW / TEMPORARY WORKING CODE SECTION

            skodak Petr Skoda
            wjwood64 Bill (Inactive)
            Nobody Nobody (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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