2

I have a group of users who are allowed to create entries and edit them but I want to put a window on how much time they have in which they can edit it. For example, after initial submission they would only have two weeks to edit the entry before only an admin can make changes to that entry.

I understand how to run the logic to check the user groups and calculate cut-off dates but I have no idea where I need to hook in to be able to do this.

Is there anywhere I can hook in to run this logic? If so, where is this?

Any guidance would be really appreciated!

2

Seems like you'd just need to write a plugin that listened to the onBeforeSaveEntry event.

That plugin would check if the entry author is in the user group you're interested in, and if it's a new entry just let it save.

If it's an existing entry, check the dateCreated date against your window and see if it's still valid. If it's outside of your window you can set performAction to false so the entry won't save and set a flash message indicating they're outside the window.

  • That gets me moving in the right direction though I was hoping to be able to notify the user before they hit save. If they did a lengthly edit and tried to save it could be very frustrating for them! This solution lets me tick the box on the spec (thank you) but it would be nice to be able to polish the UX on this one. Any ideas? – Leonard Sep 18 '16 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.