Prevent/Disable editing a page as long it is published/listed


we’d like to enhance the current publishing workflow in that way that a published page cannot be edited unless the user unpublishes the page. How could that be achieved. We already use blueprints depending on the users’ role which helps us preventing a “normal” user to publish a page.

Any ideas are welcome, thanks in advance,

Thomas E.-E.

You can probably do something as simple as this I guess

# Prevent page from beign changed if published
'page.update:before' => function ($page, $values, $strings) {
    if (!$page->isDraft())
        throw new Exception('Published pages cannot be updated');


This won’t prevent a page from being updated in the panel but will prevent the changes from being saved.

No need to say that this is just the simplest solution, you should probably try find a more elegant way to let users know they can’t update a published page.

thanks for sharing your thoughts @manuelmoreale. I would prefer a more obvious solution though. When a page “seems” to be editable but in the end is not this is somewhat disapointing from the UX point of view.

Probably the hook could be used to change a certain state of the page which completely disables all its fields dynamically? Would that be possible?

Another option would be to create a custom PagePermissions class and in that class add an canUpdate() method. Then in a Page model overwrite the permissions method to use the new class instead of the old.

Be careful with the permissions.

1 Like