Marco Angeli Posted June 4, 2014 Posted June 4, 2014 Hi there, we all use this: <?php // If the page is editable, then output a link that takes us straight to the page edit screen: if($page->editable()) { echo "<a class='nav' id='editpage' href='{$config->urls->admin}page/edit/?id={$page->id}'>Edit</a>"; } ?> Unfortunately, I always see the edit link, even if I'm logged out... Very strange...recently I switched from test mode in a sub-domain (new.mysite.com) to production mode (www.mysite.com). Could this be an issue?
Soma Posted June 4, 2014 Posted June 4, 2014 Nope. No idea. Is it cached? Although it wouldn't get cached when logged in. Any third party modules modifying Page::editable?
3fingers Posted June 4, 2014 Posted June 4, 2014 Have you tried: if($page->editable()&& $user->isLoggedin()) { // also check if the user is currently logged in echo "<a class='nav' id='editpage' href='{$config->urls->admin}page/edit/?id={$page->id}'>Edit</a>"; } to make a double check that the current user is logged in? 1
Soma Posted June 4, 2014 Posted June 4, 2014 $user->isLoggedin() shouldn't be necessary here as $page->editable() already checks for various permission etc. So maybe do you have the guest role given page edit access? What happens if you click the link? Well I'm waiting for a facepalm here cause it's not possible. 2
Marco Angeli Posted June 5, 2014 Author Posted June 5, 2014 Soma is right: I gave the guest role page edit access... thanks! (kids, don't try this at home!) 2
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