Display Item Owner with Item Metadata


I'd like to be able to show the name of the Item owner on the public facing side of the site (and possibly sort by owner when browsing all items).

I can go into show.php and figure out how to show or hide other metadata fields, but since the owner is not technically an element of the item, I'm not sure how to reference it. Has anyone else tried this or had any luck?


In show.php, you could use something similar to and building off of this. Just a matter of digging up the owner record from the User table.

$owner = $item->getOwner();
echo metadata($owner, 'name');

Sorting by owner when browsing items is trickier, and would call for a plugin that uses the items_browse_sql hook (sadly lacking examples, sorry, but in it you would join on the users table via owner_id for the sorting).

(If you haven't seen it already, the User Profiles plugin might also be of interest for connecting items and users.)

This is exactly what I needed. Thanks so much!