diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index de6da79f..eb57ce99 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -547,6 +547,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr return $id; } else if($id && is_numeric($id)) { + $currentStage = Versioned::get_reading_mode(); + if($this->getRequest()->getVar('Version')) { $versionID = (int) $this->getRequest()->getVar('Version'); } @@ -564,7 +566,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr singleton($treeClass)->flushCache(); $record = DataObject::get_by_id($treeClass, $id); - if($record) Versioned::set_reading_mode(''); } // Then, try getting a deleted record @@ -583,6 +584,9 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr $record = null; }*/ + // Set the reading mode back to what it was. + Versioned::set_reading_mode($currentStage); + return $record; } else if(substr($id,0,3) == 'new') {