From 91591a375291ad3445afcb8b29796e351ab22b31 Mon Sep 17 00:00:00 2001 From: John Milmine Date: Mon, 24 Nov 2014 15:32:05 +1300 Subject: [PATCH] redirect_fix_between_CMS_sections previously if you were editing settings and you changed subsites ti would revert you to /admin, now it stays within your current controller --- code/extensions/LeftAndMainSubsites.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/code/extensions/LeftAndMainSubsites.php b/code/extensions/LeftAndMainSubsites.php index 24cae64..a0f3497 100644 --- a/code/extensions/LeftAndMainSubsites.php +++ b/code/extensions/LeftAndMainSubsites.php @@ -217,7 +217,11 @@ class LeftAndMainSubsites extends Extension { // Update current subsite in session Subsite::changeSubsite($_GET['SubsiteID']); - //Redirect to clear the current page + if ($this->owner->canView(Member::currentUser())) { + //Redirect to clear the current page + return $this->owner->redirect($this->owner->Link()); + } + //Redirect to the default CMS section return $this->owner->redirect('admin/'); } @@ -230,7 +234,11 @@ class LeftAndMainSubsites extends Extension { // Update current subsite in session Subsite::changeSubsite($record->SubsiteID); - //Redirect to clear the current page + if ($this->owner->canView(Member::currentUser())) { + //Redirect to clear the current page + return $this->owner->redirect($this->owner->Link()); + } + //Redirect to the default CMS section return $this->owner->redirect('admin/'); }