Forums / Setup & design / fetch user name from user_id or object_id

fetch user name from user_id or object_id

Author Message

nigel dodd

Monday 27 March 2006 1:50:17 am

What is the most direct method of getting a user name from the user_id (or object_id) of a user account?

I need to do this because Norman Leutner's excellent topauthors extension gets authors who have contributed the most but it provides only the user_id (which appears to be the same as the object_id). I need to look up the actual name of the author but all the fetch examples use node_ids rather than object_ids.

Kristof Coomans

Monday 27 March 2006 2:35:27 am

{def $user=fetch('content', 'object', hash( 'object_id', $user_id ) )}
{$user.name|wash}
{undef $user}

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

nigel dodd

Monday 27 March 2006 2:40:14 am

Well, of course it is

let myuser=fetch('content',object,hash(object_id,$topten.user_id))

Now, why could I not find that easily in the documentation?

Thanks Kristof, you beat me to my own reply!