Forums / Install & configuration / How to fetch user by user ID?

How to fetch user by user ID?

Author Message

Jorge estévez

Sunday 02 May 2010 6:42:57 pm

Hello

 

I need to fetch user by user ID, so when an article is showed I can also get some information about the user that created the article an display his image, name etc.

 

Something similar as posted at http://share.ez.no/forums/setup-design/rss-problem-and-fetch-user-by-id, but with no answer at all.

 

thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Peter Keung

Sunday 02 May 2010 10:12:46 pm

User IDs in eZ Publish are their content object IDs, so you could use the content / object fetch and then output the attributes like any normal content object.

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada

Abdelkader RHOUATI

Monday 03 May 2010 2:42:43 am

Hello Jorge,

For your need, there are simpler; in each node geted by a fetch, you will find an "owner" attribute, it is the object that corresponds to the user who created this node.

So to display the image and name of the creator of a node, you do:

{attribute_view_gui attribute=$node.object.owner.data_map.image image_class=medium}
 By: M. {$node.object.owner.name|wash()}

Regrads

Abdelkader RHOUATI

Blog (french) : http://arhouati.com
----
Extension arh_jdebug : EzDebug using jquery

Jorge estévez

Monday 03 May 2010 4:43:08 am

Thanks

I will give it a try!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com