MDL-30569 Administration Fixing the redirect after editting is toggeled on the front...
authorAnkit Kumar Agarwal <ankit@moodle.com>
Thu, 15 Dec 2011 02:53:15 +0000 (08:23 +0530)
committerAnkit Kumar Agarwal <ankit@moodle.com>
Thu, 15 Dec 2011 02:53:15 +0000 (08:23 +0530)
course/view.php

index 28ed124..a930df3 100644 (file)
     if ($PAGE->user_allowed_editing()) {
         if (($edit == 1) and confirm_sesskey()) {
             $USER->editing = 1;
     if ($PAGE->user_allowed_editing()) {
         if (($edit == 1) and confirm_sesskey()) {
             $USER->editing = 1;
-            redirect($PAGE->url);
+            // Redirect to site root if Editing is toggled on frontpage
+            if ($course->id == SITEID) {
+                redirect($CFG->wwwroot .'/?redirect=0');
+            } else {
+                redirect($PAGE->url);
+            }
         } else if (($edit == 0) and confirm_sesskey()) {
             $USER->editing = 0;
             if(!empty($USER->activitycopy) && $USER->activitycopycourse == $course->id) {
                 $USER->activitycopy       = false;
                 $USER->activitycopycourse = NULL;
             }
         } else if (($edit == 0) and confirm_sesskey()) {
             $USER->editing = 0;
             if(!empty($USER->activitycopy) && $USER->activitycopycourse == $course->id) {
                 $USER->activitycopy       = false;
                 $USER->activitycopycourse = NULL;
             }
-            redirect($PAGE->url);
+            // Redirect to site root if Editing is toggled on frontpage
+            if ($course->id == SITEID) {
+                redirect($CFG->wwwroot .'/?redirect=0');
+            } else {
+                redirect($PAGE->url);
+            }
         }
 
         if ($hide && confirm_sesskey()) {
         }
 
         if ($hide && confirm_sesskey()) {