How to get latest changed pages

Hello,

i try to code a widget that displays changed sites (with date)… so something like the build in “your last changed pages” but for all users.

The widget collects pages with: 'history' => panel()->user()->history()->get()

How can i get a sorted list of lately changed pages with date/time?

thx in advance,
svnt

The history method only saves a list of pages without date/time. You could, however, get the modified timestamp using the $page->modified() method.

Please note that the history method only logs changes made to pages, i.e. not file uploads or deletes or changes to site settings. To log all changes done to the site, you could build a history using hooks (like the Auto-Git or Logger plugins).

Thank you!

Oh, I see! The history is the data coming from the account file of the user:

history:
  - about
  - home
  - message-received
...

For a widget 'changes' => panel()->site()->index()->sortBy('modified', 'desc')->limit(10) does the job well.

But i have found something way more cool: https://github.com/texnixe/kirby-logger :wink:

:heart_eyes:

1 Like