Kirby3 blueprint or hook to show info of which user created / modified a page

Hi all,

Is there anyway to show the user who created and modified a page? I was able to get the info for page modification using the page modified reference object:

  type: info
  label: Page Modified
  text: "{{ page.modified('D. M j, Y — g:ia') }}"

The above turned into: Fri. Jul 24, 2020 — 1:42pm

However, I wasn’t able to find the same for page creation (i.e. page.create, page.created) as this caused some error, expectedly.

My goal is to have the info field display something like:
Page Created by ‘Some User’ on ‘Fri. Jul 24, 2020 — 1:42pm’
Page Modified by ‘Another User’ on ‘Fri. Jul 24, 2020 — 2:02pm’

I used this Date Extended Plugin which extended the page creation time, worked real nice!

  • So with either solution above, is there a way to also show the name of the user that created or modified a given page within the info field type?

  • And while we are on this topic, the date format I’m using (‘D. M j, Y — g:ia’) works great, but the actually time is a few hours off, not showing local time based on users machine (I’ve only tested localhost, is there a UTC local timezone I add to my php.ini file or something?)

For example, my log above (Fri. Jul 24, 2020 — 1:42pm) should’ve been Fri. Jul 24, 2020 — 8:42am (time was 5 hours or so ahead of local time)

Hope this makes sense, thank you all for your help! :sunglasses:

If you need the creation date, you have to store it in the page content, either using a hook or via the plugin that does this for you.

If you want to have the user who created a page, you also have to store the user e.g. by adding a user field to your blueprint, which is required and disabled.

For the user who modified a page, you would also have to store this information via a hook (depending on what you want to count as changes, you need multiple hooks, page.changeTitle, page.update, page.changeStatus etc.)


Look at my HowTo: Automatic update of the ‘last_updated’ field in the Panel.

Good luck!

1 Like

Hey @pixelijn, thanks for the reply!

Sorry, I’m pretty new to Kirby / PHP… can you provide a little code block / example of what it would take to store the “creation date” in a hook? I think once I see an example, I can roll into the User blueprint and those hooks, lead by example.

Or is there a Kirby 3 plugin that does either of these for the creation hook and/or the User stuff? I didn’t see anything, but maybe I wasn’t searching the right keywords.


Oh, nice! Thanks for the link above, I’m checking this out now :slight_smile:

As I said, for the create user and date, you don’t need the hooks, only for the modification data.

   type: date
   label: Creation date
   default: now
   required: true

(Unless you want to store the date in a different format (Unix timestamp))

Thanks @pixelijn!

So in your example here with the creationDate field - I didn’t want to use the type: date - wanted to just log this as a type: info so it appears more as a readonly thing. So would I have to use a Hook like your modified example in this case?

That’s not possible, the info field doesn’t store anything, you can only use it to display stuff that is already stored in other fields. You can use hidden fields, though to store the information.

What is set in your php.ini as date.timezone? For me, for example, it is "Europe/Berlin" because my server is located in this timezone. Also, what will be shown if you change the format to D. M j, Y — g:ia e, that is, adding and showing the timezone value (instead of e, you can use P or T or any other of the timezone formatting characters)?

@pixelijn Right, sorry, ha. So yeah, I’m only wanting to display the creation / modification times like a little log. Not really storing this in the blueprint per-say, so I think I can do a cool combo of your example and what the Date Extended Plugin was doing.

But I think I see what you mean by using the hidden field, then the info could display what that stores? :thinking:

Hi @Adspectus! Thanks for the timezone help…

My php.ini has this:
date.timezone = "America/Denver"

But again, I haven’t pushed this up to a server, so maybe this just doesn’t work for localhost?

Oh, and I edited the format to 'D. M j, Y — g:ia T' which gives me this output:
Fri. Jul 24, 2020 — 1:42pm UTC

If “America/Denver” works when I push to a server though, will a user on the West Coast see the timestamp an hour ahead? Can i normalize it to a user’s local time?


1 Like

Hi @pixelijn - pretty much have it working, thanks again! Here’s a screenshot of my progress:

And my blueprint fields look like so:

  label: Created by
  type: users
  multiple: false
  disabled: true
  width: 1/2
  type: info
  label: false
  text: Page Created on {{ page.created.time.toDate('D. M j, Y — g:ia') }}
  type: line
  label: Last updated by
  type: users
  multiple: false
  disabled: true
  width: 1/2
  type: info
  label: false
  text: Page modified on {{ page.modified('D. M j, Y — g:ia') }} 

Both info fields are displaying the page.created and page.modified times without any hooks, the users fields are pulled in from your example hook - nice!!

  • Can I hide the users field or remove this field, but pull in their username from the hook callback into the info field?
  • I can’t hide the users field, because if I set this to type: hidden, how will it be type: users?

Can I pull in the username value only?

  type: info
  label: false
  text: Page modified by {{ lastUpdatedBy.username }} on {{ page.modified('D. M j, Y — g:ia') }}

This obviously doesn’t work, but anyway to fetch the value of lastUpdatedBy?

If not, I can just hack away the CSS stuff to pretty this all up as is, but ideally I’m just trying to have a single info field display the username and date in one pass.

Thanks! :woozy_face: :+1:

Not sure if a hidden field could have a default value current user. But you could use a page model to store the current user in this hidden field (as an alternative to using a hook)

To get the username:


should work.

1 Like

Woah!! @texnixe thank you so much, this totally works, just tested it out! :sunglasses:

I’m newer to these forums, can I mark both this and @pixelijn’s answer earlier in the thread as ‘Solved’? Want to give both credit for these answers.



  type: hidden
  default: "{{ kirby.user }}"

works. So no hook or model necessary for the createdBy hidden field.

Cool! I also have this working without the need for the createdBy hidden field:

  type: info
  label: false
  text: Page Created by {{ page.createdBy.username.toUser.username }} on {{ page.created.time.toDate('D. M j, Y — g:ia') }}

Page Created by Something Strange on Fri. Jul 24, 2020 — 7:30pm

Where does the information come from then? After all, createdBy is a field, so is created.

this syntax is somehow wrong with the dot between created and time:

page.created.time.toDate('D. M j, Y — g:ia')

What’s the name of the field, created or time?

I have no idea haha, thought it might be some default Kirby stuff I missed? I just tested this with two users logged in and multiple updates, seems to be working?

Or… do you think this is just displaying the last non-error state, and this is silently failing under the hood?

Haha, I have lost track what you now have a) in your blueprint b) in your content file and c) in your hooks or if or if not the plugin is still at work…