Jump to content

[solved] Conditionally limiting editing of page based on page properties and role


Kiwi Chris
 Share

Recommended Posts

I need to restrict editing access based on both the user role, and the value of a sub-field in a page reference field.

eg $page->competition->closingDate 

There's some discussion about restricting editing access based on role, and that works, but when I try to access the page via the method @Robin S suggests, the page returned is an admin page rather than the page being edited, so I don't have access to the edited page's fields.

 

Link to comment
Share on other sites

18 minutes ago, Kiwi Chris said:

I need to restrict editing access based on both the user role, and the value of a sub-field in a page reference field.

I think you'll want to hook Page::editable in /site/init.php and set the event return to false if the user should not be able to edit the page.

 

  • Like 1
Link to comment
Share on other sites

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
 Share

×
×
  • Create New...