Add User Who Created Item to detailed-view.php

So I have a class of 20 people adding items to an archive. I would like to be able to see who, by username, added which item.

I tried adding this line to detailed-view.php in the "item-meta" div, where Creator, Type, Added, and Collection are already (I've broken it into multiple lines to make the relevant bit obvious):

<span class="fieldname">User:</span>
<?php echo getUserWhoCreated()->username; ?>

The error I get says: Fatal error: Call to undefined function getUserWhoCreated()...

Any thoughts? I am almost certainly borking some aspect of the PHP (I'm kind of guessing at syntax and how one uses methods); but I consulted this forum post as well as documentation for the User and Item classes. Is there an easier way to implement this?

getUserWhoCreated() is a method of the Item class. Essentially, this means that you have to call it like this:


Gotcha. This code did the trick:

<li><span class="fieldname">User:</span>
<?php echo $item->GetUserWhoCreated()->username; ?>


(I'd mark the thread "resolved" but in both FF and Chrome I just see the red dot icon with no pull down...)