Jump to content

Prevent field from updating page edit timestamp


statestreet
 Share

Recommended Posts

I have some functionality on an intranet site that uses Lazy Cron to query an external API and then update a bunch of pages based on the API response.
 
A problem I've noticed is that this breaks our author / editor tracking – whenever a user triggers the Lazy Cron job, the page metadata for `$page->modified` and `$page->modifiedUser` is (naturally) updated, so it now looks like that user edited the page at that moment in time, even if the content of the page was edited months ago by someone else.

It seems like the ideal solution here would be to somehow exempt certain fields (the ones that get updated by this external API) from triggering a timestamp update... Any ideas on how I'd go about hooking into that?

Link to comment
Share on other sites

The fields modified and modified_users_id are in the table pages. If there is no direct API based way to manipulate it, one can read the values before a page is updated via the lazycron script, and set the values back afterwards, via direct access to the DB table.

But I highly recommend to read this (complete) thread: https://processwire.com/talk/topic/8188-edit-created-and-modified-date/

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...