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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 02:10:11
Script start
Timing: Jan 18 2025 02:10:11
Module start 'layout'
Timing: Jan 18 2025 02:10:11
Module start 'content'
Timing: Jan 18 2025 02:10:12
Module end 'content'
Timing: Jan 18 2025 02:10:12
Script end

Main resources:

Total runtime0.6505 sec
Peak memory usage4,096.0000 KB
Database Queries64

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 589.1484152.6406
Module start 'layout' 0.00660.0034 741.789139.4766
Module start 'content' 0.01000.6388 781.2656590.8359
Module end 'content' 0.64880.0016 1,372.101612.4609
Script end 0.6504  1,384.5625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.5161160.0002
Check MTime0.00130.2063160.0001
Mysql Total
Database connection0.00130.203510.0013
Mysqli_queries0.596591.7017640.0093
Looping result0.00050.0783620.0000
Template Total0.612494.220.3062
Template load0.00200.315120.0010
Template processing0.610493.832320.3052
Template load and register function0.00020.024610.0002
states
state_id_array0.00250.387710.0025
state_identifier_array0.00110.171120.0006
Override
Cache load0.00160.2515250.0001
Sytem overhead
Fetch class attribute can translate value0.00060.092030.0002
Fetch class attribute name0.00100.153360.0002
XML
Image XML parsing0.00120.184730.0004
class_abstraction
Instantiating content class attribute0.00000.001560.0000
General
dbfile0.00110.1616230.0000
String conversion0.00000.001740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs