Juergen

$page->resetTrackChanges(); doesnt work in my case

Recommended Posts

Hello,

I want to reset the tracked changes on the edited page if a checkbox is checked. But unfortunately the changes are still there.

Here is what I have so far:

$pages->addHookBefore('saveReady', function($event)
{
  $page = $event->arguments[0];  
  if($page->createevents == true) { 
   $page->resetTrackChanges(); 
  } 
});

So its a simple hook that runs before the page is saved. If the checkbox called "createevents" is checked, then the tracked changes should be reset. But this doesnt work. I was looking at http://cheatsheet.processwire.com/pagearray-wirearray/change-tracking/a-resettrackchanges/ and also at this post from Ryan (https://processwire.com/talk/topic/4880-questions-about-the-usage-of-trackchanges/?do=findComment&comment=47670) but I dont know why it is not working.

Only to mention: I use the latest dev and PHP 7

Maybe someone can help me out?

 

Share this post


Link to post
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


  • Recently Browsing   0 members

    No registered users viewing this page.