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!

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 18:18:44
Script start
Timing: Jan 18 2025 18:18:44
Module start 'layout'
Timing: Jan 18 2025 18:18:44
Module start 'content'
Timing: Jan 18 2025 18:18:45
Module end 'content'
Timing: Jan 18 2025 18:18:45
Script end

Main resources:

Total runtime0.7576 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 589.1719152.6406
Module start 'layout' 0.00680.0031 741.812539.4766
Module start 'content' 0.01000.7457 781.2891536.5391
Module end 'content' 0.75570.0019 1,317.828112.1250
Script end 0.7575  1,329.9531 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4664160.0002
Check MTime0.00140.1804160.0001
Mysql Total
Database connection0.00140.181010.0014
Mysqli_queries0.699992.3807570.0123
Looping result0.00050.0725550.0000
Template Total0.723695.520.3618
Template load0.00260.343320.0013
Template processing0.721095.172520.3605
Template load and register function0.00020.021210.0002
states
state_id_array0.00100.132210.0010
state_identifier_array0.00170.224220.0008
Override
Cache load0.00210.2799150.0001
Sytem overhead
Fetch class attribute can translate value0.00070.089020.0003
Fetch class attribute name0.00150.202850.0003
XML
Image XML parsing0.00320.424820.0016
class_abstraction
Instantiating content class attribute0.00000.001760.0000
General
dbfile0.00370.4819220.0002
String conversion0.00000.001240.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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.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: 11
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs