Joe Posted November 2, 2013 Share Posted November 2, 2013 Hi all! A quick question, if it has been treated somewhere else I´m thankful for the link... Is it possible to permit users to edit certain pages but keep them from deleting them? I´ve looked at the "Page Edit Per User" module, but that doesn´t seem to make this possible. This should only apply to specific pages, not all of them. Thanks! Link to comment Share on other sites More sharing options...
ryan Posted November 6, 2013 Share Posted November 6, 2013 If you don't want a user deleting pages, then it should be as simple as not giving them page-delete permission. If you want to change the behavior on a per-template basis, then come up with two roles... one that has delete permission and another that doesn't. Give the user both roles. On templates where you want them to be able to delete pages, assign both roles. On templates where you don't want them to be able to delete, then only assign edit permission to the role without page-delete permission. 5 Link to comment Share on other sites More sharing options...
Joe Posted November 7, 2013 Author Share Posted November 7, 2013 Thank you Ryan! Well, I meant just one specific page that uses the same template as others. I suppose then, I would have to not use the same template for it but a renamed copy thereof and assign permissions for that new template accordingly. Link to comment Share on other sites More sharing options...
ryan Posted November 9, 2013 Share Posted November 9, 2013 ProcessWire's permissions system is designed to deal with groups of pages (by template). When you get into wanting to assign permission for a specific individual page, the best way is to use your own code to identify the page. An example would be a hook in /site/templates/admin.php wire()->addHook('Page::editable', function($event) { if($event->return) return; $page = $event->object; $user = wire('user'); // if page ID is 123 and user is "joe" allow edit access if($page->id == 123 && $user->name == 'joe') $event->return = true; }); 4 Link to comment Share on other sites More sharing options...
Joe Posted November 9, 2013 Author Share Posted November 9, 2013 Oh thanks, Ryan! Hadn´t thought of something like that - it looks very simple to do it this way! I´m really happy about how easily solutions for special situations in Processwire can be found! The more I get to know it the happier I am with it. And also I find this forum a really friendly and helpful place! 1 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