renobird Posted March 16, 2015 Share Posted March 16, 2015 I'm looking to check if $page->modifiedUser has changed in a (saveReady) hook. $page->getChanges() doesn't contain modified_user_id, or modified (I think that is set by mySQL). Any pointers? Link to comment Share on other sites More sharing options...
LostKobrakai Posted March 16, 2015 Share Posted March 16, 2015 From a quick look in Page.php it sees this should be tracked. See those: https://github.com/ryancramerdesign/ProcessWire/blob/576a5d30153f045daa94a136a6ba981650632b26/wire/core/Page.php#L908 https://github.com/ryancramerdesign/ProcessWire/blob/576a5d30153f045daa94a136a6ba981650632b26/wire/core/Page.php#L422 Link to comment Share on other sites More sharing options...
renobird Posted March 16, 2015 Author Share Posted March 16, 2015 I saw that, but it doesn't seem to be part of getChanges() when I list them all out. Link to comment Share on other sites More sharing options...
renobird Posted March 16, 2015 Author Share Posted March 16, 2015 works as expected on other fields, including status. public function hookSaveReady(HookEvent $event){ $page = $event->arguments[0]; $changes = $page->getChanges(); foreach ($changes as $change) { $this->session->message($change); } } Link to comment Share on other sites More sharing options...
renobird Posted March 17, 2015 Author Share Posted March 17, 2015 I'll need to dig a little further…. if I check $page->ModifiedUser from saveReady, it still shows the value currently in the DB, not the value of the user who is saving this page. Link to comment Share on other sites More sharing options...
renobird Posted March 17, 2015 Author Share Posted March 17, 2015 Looks like I found it. https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/Pages.php#L881 1 Link to comment Share on other sites More sharing options...
LostKobrakai Posted March 17, 2015 Share Posted March 17, 2015 I had looked a little more at the core code yesterday and the only thing that seemed to be able to cause this would be disabling trackChanges for that case. Or even not changing anything. Link to comment Share on other sites More sharing options...
renobird Posted March 17, 2015 Author Share Posted March 17, 2015 If I set $page->modifiedUser = $this->user in my saveReady hook, then $page->getChanges() has modified_users_id. This works, and will allow me to move on. Would be nice to know if there is a "proper" way. Link to comment Share on other sites More sharing options...
LostKobrakai Posted March 17, 2015 Share Posted March 17, 2015 I would think that this should happen without manually assigning the user. 1 Link to comment Share on other sites More sharing options...
renobird Posted March 17, 2015 Author Share Posted March 17, 2015 I'm kind of rushing to get this out the door—so I'm just looking quickly—but it appears there is a quiet mode which probably explains why it's not there. Link to comment Share on other sites More sharing options...
LostKobrakai Posted March 17, 2015 Share Posted March 17, 2015 This still does not explain why a page has a modified_users_id if it won't change depending on who's saving the page. 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