Jump to content

Reviewer role: Permission to view unpublished pages?


Recommended Posts

Hey there,

for a client website I need to implement a "reviewer" role. "Reviewers" should be able to review new (unpublished) articles to give feedback to editors, but not have the permission to change them. 

I built a new "reviewer" role that only has page-view permissions for the respective templates, but this permission does not include viewing unpublished pages. How can I grant them access to the unpublished articles without giving them page-edit permission?


Link to comment
Share on other sites

I think you have to hook into Page::viewable, then detect if user has role reviewer and page is unpublished. If yes, you can change the return to true. Please search for hook examples with Page::viewable here in the forums. There will be some available. 

Or you look into existing modules how it is done there, like this one: https://github.com/Sebiworld/PageAccessReleasetime/blob/master/PageAccessReleasetime.module.php#L182-L201
and here https://github.com/Sebiworld/PageAccessReleasetime/blob/master/PageAccessReleasetime.module.php#L241-L254

And you don't need to build a module, you can write the hook into the site/ready.php file.

  • Like 2
Link to comment
Share on other sites

  • 2 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...