BUGFIX: When opening the CMS, switch to a site that you actually have access to. (from r88968)

This commit is contained in:
Tom Rix 2010-03-01 21:27:52 +00:00
parent 866e55d574
commit c0844e0dd9

View File

@ -14,11 +14,19 @@ class LeftAndMainSubsites extends Extension {
Requirements::javascript('subsites/javascript/LeftAndMain_Subsites.js');
Requirements::javascript('subsites/javascript/VirtualPage_Subsites.js');
// Switch to the subsite of the current page
if ($this->owner->class == 'CMSMain' && $currentPage = $this->owner->currentPage()) {
if (Subsite::currentSubsiteID() != $currentPage->SubsiteID) {
Subsite::changeSubsite($currentPage->SubsiteID);
}
}
// Switch to a subsite that this user can actually access.
$sites = Subsite::accessible_sites("CMS_ACCESS_{$this->owner->class}")->toDropdownMap();
if(!isset($sites[Subsite::currentSubsiteID()])) {
$siteIDs = array_keys($sites);
Subsite::changeSubsite($siteIDs[0]);
}
}
/**