Ran into some strange behavior after updating a multi-lang project to v5. Whenever I save a page in a secondary language it will not only save the changes to the secondary language’s text file but also overwrite the default language’s text file with its content. I think it’s somehow connected to a part of my hook logic which manages to save the modified meta (date + user):
'hooks' => [
'page.create:after' => function ($page) {
$creator = $this->user()->id();
$created = $page->modified('%Y-%m-%d %H:%M');
try {
$page->update(array(
'createdby' => $creator,
'createdon' => $created
));
} catch(Exception $e) {
echo $e->getMessage();
}
},
'page.update:after' => function ($newPage, $oldPage) {
$editor = $this->user()->id();
$modified = $newPage->modified('%Y-%m-%d %H:%M');
try {
$newPage->update(array(
'lasteditby' => $editor,
'lastediton' => $modified
));
} catch(Exception $e) {
echo $e->getMessage();
}
}
],
If I drop this from the config.php it all works fine again. Also no issues if I leave it there and go back to v4.8.0. Any idea what I’m doing wrong?