Problems with $current_user fetch

Author Message

Federico Canuti

Sunday 25 December 2005 7:43:11 pm

Hello, I don't understand correctly how to use the current_user :
looking in the documentation I found this (working) code
{def $user=fetch( 'user', 'current_user' )}
User: {$user.contentobject.name} <br />
E-mail: {$user.email} <br />
.....
But I can't in any way extract others attributes from my $user object.
There is written that this function "will return an ezuser object" but I've tried all of this code without succes:
Nome: {$user.first_name}
Nome: {$user.object.data_map.first_name}
Nome: {$user.data_map.first_name}
all of them with ".content| wash" or "{attribute_view_gui attribute=$user.data_map.first_name}"

How can I use all of my current user attributes as text or raw data (and store them in variables) ?

Kristof Coomans

Monday 26 December 2005 2:09:54 am

Try {$user.contentobject.data_map.first_name.content}.

The user/current_user fetch function returns an eZUser object, the contentobject attribute of that user object will return an eZContentObject object, the data_map attribute of that eZContentObject object will return an array of ContentObjectAttribute objects with the attribute identifiers as array keys.

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

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 22:18:59
Script start
Timing: Jan 18 2025 22:18:59
Module start 'layout'
Timing: Jan 18 2025 22:18:59
Module start 'content'
Timing: Jan 18 2025 22:19:00
Module end 'content'
Timing: Jan 18 2025 22:19:00
Script end

Main resources:

Total runtime0.7429 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0083 589.0547152.6250
Module start 'layout' 0.00830.0038 741.679739.4453
Module start 'content' 0.01220.7290 781.1250522.8984
Module end 'content' 0.74120.0016 1,304.02348.1563
Script end 0.7428  1,312.1797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4656160.0002
Check MTime0.00140.1821160.0001
Mysql Total
Database connection0.00360.479910.0036
Mysqli_queries0.685092.2130540.0127
Looping result0.00080.1037520.0000
Template Total0.702394.520.3511
Template load0.00220.302320.0011
Template processing0.700094.231420.3500
Template load and register function0.00020.026310.0002
states
state_id_array0.00150.207410.0015
state_identifier_array0.00080.108920.0004
Override
Cache load0.00180.2376200.0001
Sytem overhead
Fetch class attribute can translate value0.00130.179620.0007
Fetch class attribute name0.00110.146630.0004
XML
Image XML parsing0.00070.096020.0004
class_abstraction
Instantiating content class attribute0.00000.001030.0000
General
dbfile0.00180.2390160.0001
String conversion0.00000.001340.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 8
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs