Show page owners in page list?
Permalink
I'm using a page list as my blog index, and under the title and creation date of each blog post that's listed there, I want to show the page owner...something like:
Tips To Get healthy
January 3rd, 2013
Written by Oliver Green <---
I know how to display the page owner on an individual blog post, but I need to know how to show the various page owners in a page list..make sense?
Tips To Get healthy
January 3rd, 2013
Written by Oliver Green <---
I know how to display the page owner on an individual blog post, but I need to know how to show the various page owners in a page list..make sense?
Thanks for your response. I placed this code in my blog_index.php file, but instead of showing me the author of each blog post, it's showing me the currently logged in user (which happens to be 'site administrator'). Please see attachment.
It works for me, so maybe the "author" isn't who you think it is.
You could try
instead
Note that the above shows the author of the published version, which may well be different to the user who originally created the page, which never changes.
You could try
$author = UserInfo::getByID($page->getVersionObject()->getVersionAuthorUserID()); echo $author->getUserBillingFirstName() . ' '.$author->getUserBillingLastName();
instead
Note that the above shows the author of the published version, which may well be different to the user who originally created the page, which never changes.
Note that getUserBillingLastName() etc *may not* work for you and this depends on what the attribute handle(s) are that hold your users' real names. For example if the attribute handle is my_real_name, then you should call getUserMyRealName().
Check /dashboard/users/attributes to see the handles