diff --git a/code/controllers/ContentController.php b/code/controllers/ContentController.php
index b1458109..ce0bb148 100644
--- a/code/controllers/ContentController.php
+++ b/code/controllers/ContentController.php
@@ -120,12 +120,6 @@ class ContentController extends Controller {
)
) {
if(!$this->dataRecord->canViewStage(Versioned::current_archived_date() ? 'Stage' : Versioned::current_stage())) {
- $link = $this->Link();
- $message = _t(
- "ContentController.DRAFT_SITE_ACCESS_RESTRICTION",
- 'You must log in with your CMS password in order to view the draft or archived content. ' .
- 'Click here to go back to the published site.'
- );
Session::clear('currentStage');
Session::clear('archiveDate');
diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php
index 47cf8bae..c61194c4 100644
--- a/code/model/SiteTree.php
+++ b/code/model/SiteTree.php
@@ -1397,7 +1397,11 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$tags .= $this->ExtraMeta . "\n";
}
- if(Permission::check('CMS_ACCESS_CMSMain') && in_array('CMSPreviewable', class_implements($this)) && !$this instanceof ErrorPage) {
+ if(Permission::check('CMS_ACCESS_CMSMain')
+ && in_array('CMSPreviewable', class_implements($this))
+ && !$this instanceof ErrorPage
+ && $this->ID > 0
+ ) {
$tags .= "ID}\" />\n";
$tags .= "CMSEditLink() . "\" />\n";
}
diff --git a/tests/behat/features/insert-a-link.feature b/tests/behat/features/insert-a-link.feature
index c64ee80e..be57ac3c 100644
--- a/tests/behat/features/insert-a-link.feature
+++ b/tests/behat/features/insert-a-link.feature
@@ -50,8 +50,7 @@ So that I can link to a external website or a page on my site
And I select "awesome" in the "Content" HTML field
When I press the "Insert Link" button
When I select the "Anchor on this page" radio button
- # Need to hard-code the id attribute of the