Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions

How to display Created/Last Published Author


5 Posts   502 Views


30 May 2013 at 5:40am (Last edited: 30 May 2013 5:40am), Community Member, 75 Posts

I may be missing something, but I can't find a way to display the name of a page's author or publisher.

I need to include the following byline on the footer of each page:
"Page last updated by [Author] on $LastEdited"

What is the cleanest way to achieve this? Thank you!


31 May 2013 at 12:32am Community Member, 215 Posts

class Page extends SiteTree{
   static $has_one = array(
      'Author' => 'Member',
   function onBeforeWrite() {
      $this->AuthorID = Member::currentUserID();

"Page last updated by $Author.Firstname $Author.Surname on $LastEdited"


31 May 2013 at 12:21pm Community Member, 75 Posts

Thanks Devlin.

I was hoping I might be able to use the preexisting versioning information somehow (since its available on the history tab for each page), but I may have to do it this way, since I can't find another working solution.


31 May 2013 at 7:31pm (Last edited: 31 May 2013 7:41pm), Community Member, 215 Posts

Well as you mentioned it. You could do this without any php modifications:

"Page last updated by $allVersions.First.Author.Surname on $LastEdited"

But I think the first solution is cleaner. (edit: -- since I like to truncate the versions table once in a while.)


2 June 2013 at 2:59pm Forum Moderator, 5511 Posts

Pretty sure you can just do $Author.Name to get any page author's name.