Forums / Setup & design / Problems with $current_user fetch

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