Finding Page Author (Creator)

Permalink
I need to display info on the creator (not most recent editor) of a page. I tried $c->getCollectionUserID() which loads the most recent editor.

It's definitely recorded in the Collection Versions table but I'm struggling to figure out how to get it through the API. Tried this but no luck:
$originalPage=Page::getByID($p->getCollectionID, $version="1");
echo $originalPage->getVersionObject()->getVersionAuthorUserName();

Any ideas? Thanks!

goldfish
 
jordanlev replied on at Permalink Best Answer Reply
jordanlev
Hmm... I think your code is correct for the most part -- just a few typos. getCollectionID is a function, so you need parentheses after it. Also, pass in number 1 as a number, not a string (so no quotes around it). Also, don't assign it to a variable -- that is not necessary and might mess things up somehow. So I think this might work:
$originalPage = Page::getByID($p->getCollectionID(), 1);
echo $originalPage->getVersionObject()->getVersionAuthorUserName();


If that doesn't work, it's possible that the first version has an id other than 1 (although I'm not sure how that would happen). If that's the case, you'd need to run a SQL query to fetch the minimum version number for that cID.
goldfish replied on at Permalink Reply
goldfish
Thanks Jordan, that did the trick.