getgrav / getgrav/grav-plugin-admin

Lock files that are being edited: maybe add new Admin events?

Open
#2,155 1 comment 1 reaction 1 assignee Claimed by @mahagr View on GitHub
enhancement
Dominant language
PHP
Stars
377
Forks
225
Avg merge
11h 51m
Merged PRs (30d)
4

Description

I have a site or two where there are several users working on page content (all using Admin), and we have found that they can easily open the same page at the same time, and then whoever saves last gets to keep their changes and the others have theirs overwritten. I thought I could easily fix this with a plugin that sets a lockfile whenever someone opens a page – but I can't seem to find the right event to hook into. `onAdminTaskExecuted` seems to be the only one that's fired when a page is opened in Admin, and I can't find any information about which page has been opened in there. (This is probably due to temporary blindness on my behalf, but I'm still at a loss right now.)

So my question is, is there currently a way to determine what page a user is editing? And if so, how? If there is no (practical) way, would it be very difficult to add two events `onAdminPageOpened` and `onAdminPageClosed` or similar that contain the necessary information?

By the way, I also started a [thread in the Discourse forum](https://discourse.getgrav.org/t/admin-lock-page-for-other-users-while-editing/17080/10).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.