Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Disable CMS preview on a Page type basis


Go to End


960 Views

Avatar
Double-A-Ron

Community Member, 607 Posts

14 March 2014 at 9:14am

We have several pages that pull data from an API and display on page. These API calls are reliant on a user being logged in to the Frontend (nothing to do with Member class). If there is no Frontend User, redirection takes place to get the visitor to log in.

The problem is if an Admin user is logged in to the CMS, but not logged in to the Frontend of the site, when they click on these pages, preview mode triggers this same redirection and unpredictable results.

These pages have no content and never will. Preview mode is not necessary for them anyway. The only things that may ever change on these pages is Title, Meta etc.

Is there a way to programatically block preview mode for selected page types? The best I can do for now is add a canView() to them and stop them from being loaded at all.