androbey Posted December 2, 2020 Share Posted December 2, 2020 Hi all, For one page template I want to track all changes made to pages with this template (ideally including repeater fields). However, I can't even track changes of simple text fields and I don't know why. It's important to note that I add and change pages via the API and not in the backend. For each page change I added: <?php // get the page $p $p->setTrackChanges(Wire::trackChangesValues); $p->setTrackChanges(true); //do changes to fields... $p->save(); I have a autoload module which hooks after Pages::saveReady. <?php /* get the page from the HookEvent $page->getChanges(true); returns always empty array $page->getChanges(); returns always empty array However on the same run checking a field explicitly ProcessWire recognizes that a field is changed: */ if ($page->isChanged('sample_field')) { //code in here is executed.. } Changing a field in ProcessWire backend "$page->getChanges(true)" does return an assoc array with changed fields, but the value is always null. Clearly I must do something wrong, but what is ist? Link to comment Share on other sites More sharing options...
Robin S Posted December 3, 2020 Share Posted December 3, 2020 It works for me. No idea why it isn't working for you, sorry. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now