Automatic title field from date field

Thanks, @flobin, to you too. See my edited post…

I think I may have figured out why nothing was happening, because I just noticed this:

Note that the page.update:after hook is only called when the content of the page content is updated, not when the slug, title, status etc. are changed.

Here. I had been editing the title. D’oh.

When I do update the text, I get this error message:

The form could not be saved
Exception: Error
Call to a member function createdAt() on array

With page.changeTitle:after the title and slug are changed to 0. I get the following error, though:

The JSON response from the API could not be parsed. Please check your API connection.

With page.changeTitle:before the title and slug don’t change and I get this:

Call to a member function createdAt() on string

I am calling createdAt() on $oldPage, which seems to be the error.

Hi there,

not sure if (and how) you solved it, but i found this.

The message

The JSON response from the API could not be parsed. Please check your API connection

is because of this line
echo 'The page has been updated:';
which adds to the JSON response. No surprise it can’t be parsed :slight_smile:

When you remove that echo line, it works!