mpdude Posted October 16, 2023 Share Posted October 16, 2023 Hey there ??, I am evaluating ProcessWire for a new project, so this might be an easy question for somebody with more experience... Is it possible to configure permissions in a way that certain users may make changes to existing pages and preview those, but the changes will not yet be published (is that the right term?) and visible to anyone else. Only when another user with more permisssions (say, a reviewer) approves a certain change it will become visible for all website visitors? Thanks! Link to comment Share on other sites More sharing options...
BitPoet Posted October 16, 2023 Share Posted October 16, 2023 Not out of the box, but the commercial ProDrafts module provides just that. Link to comment Share on other sites More sharing options...
ngrmm Posted October 16, 2023 Share Posted October 16, 2023 2 hours ago, BitPoet said: Not out of the box, but the commercial ProDrafts module provides just that. @BitPoet I've not tried it yet, but would this be not possible with a hook on page save out of the box? Link to comment Share on other sites More sharing options...
szabesz Posted October 16, 2023 Share Posted October 16, 2023 Another and free option is this module https://processwire.com/modules/access-by-query-string/ from @Robin S It is not comparable to ProDrafts but might do what you need. Link to comment Share on other sites More sharing options...
ngrmm Posted October 16, 2023 Share Posted October 16, 2023 @mpdude try this hook – Create a role for user, who should not be able to publish pages – Put this in ready.php file in the site directory $wire->addHookBefore('Pages::save', function(HookEvent $event) { $page = $event->arguments(0); $userRole = wire('user')->role; $page->of(false); if($userRole == "your_user_role_which_can_not_publish_pages") { $page->status('unpublished'); } }); 1 Link to comment Share on other sites More sharing options...
szabesz Posted October 17, 2023 Share Posted October 17, 2023 @mpdude Using the hook like @ngrmm posted above you can fulfil this requirement: "certain users may make changes to existing pages and preview those, but the changes will not yet be published (is that the right term?) and visible to anyone else. Only when another user with more permissions (say, a reviewer) approves a certain change it will become visible for all website visitors?" And you could use Robin's module to also let clients review a page before it is published by the reviewer. 1 Link to comment Share on other sites More sharing options...
bernhard Posted October 17, 2023 Share Posted October 17, 2023 @ngrmm what you say is correct and it's very easy to PREVENT publishing of unpublished pages. But if I'm reading correctly @mpdude requested a process where an EXISTING (aka published) page can be edited by a user, but the CHANGE to that page is not published until a more privileged user approves that change, but with the original page staying unchanged and published throughout the whole change request process. I don't have experience with the ProDrafts module but it sounds like a good candidate ? Alternatively you could implement a custom logic like this: user clicks on "change request". you use the PW api to clone that page (that's really easy) and you save it under eg /drafts. you save a reference to the original page, eg via $newpage->meta('originalpage', $oldpage->id) you send an email to an admin that a new change request was created (easy using WireMail). you add a button "approve" to that page. once that button is clicked, you loop over all fields of that page and save that content to the original page (using the page meta reference). after that you can delete the draft page and you have all the changes on your original page. That way you can quite easily build very custom workflows that exactly fit your clients needs. 2 Link to comment Share on other sites More sharing options...
mpdude Posted October 17, 2023 Author Share Posted October 17, 2023 Amazing how many of you made suggestions in such a short time. Thank you all! @bernhard is on point regarding my requirements. 2 Link to comment Share on other sites More sharing options...
bernhard Posted October 17, 2023 Share Posted October 17, 2023 In almost 10 years I think I have never waited more than a day to get great answers here on the forum ? 2 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