Jonathan Lahijani Posted July 5, 2019 Share Posted July 5, 2019 I have PageFrontEdit enabled. I have a template that includes a bunch of partials. Those partials contain the PageFrontEdit tags in the following format: <edit field="body" page="<?php echo $page->id; ?>">...</edit> This is all working well, however I have a particular template whereby I don't want Frontend Page Editing to be activated at all, as if you were logged out. https://processwire.com/docs/front-end/front-end-editing/ What's the best way to disable it for a particular template? Is there a proper hook for this perhaps? Or some hackish JS approach? Link to comment Share on other sites More sharing options...
Jonathan Lahijani Posted July 6, 2019 Author Share Posted July 6, 2019 One little hackish way around this is to redirect to the same page with "?livepreview=1" appended to the URL: <?php namespace ProcessWire; if(!$_GET['livepreview']) { $session->redirect($page->url."?livepreview=1"); } Good enough for my use-case. 1 Link to comment Share on other sites More sharing options...
dragan Posted July 6, 2019 Share Posted July 6, 2019 Did you try $page->edit(false); ? Link to comment Share on other sites More sharing options...
Jonathan Lahijani Posted July 6, 2019 Author Share Posted July 6, 2019 10 hours ago, dragan said: Did you try $page->edit(false); ? Yes but that doesn't work for some reason. I believe it may have to do with partials being involved. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now