eZ Community » Forums » General » fetching User data
expandshrink

fetching User data

fetching User data

Friday 09 December 2005 9:56:46 am - 2 replies

Hi. I'm working in a extension now. in the extension i want to get information about the creator of a node. So i write some code in a .php

$nodoid=$HTTP_POST_VARS["ContentNodeID"];
$node =  & eZContentObject::fetchByNodeID  ($nodoid,  $asObject = true) ;
$owner_id=$node->attribute("owner_id");
$user  = & ezUser::fetch($owner_id,$asObject=true);

So i have the user object, but how can i get the name and other data relative to user? thanks a lot.

Monday 12 December 2005 9:20:35 am

Hi Carlos,

Use code:

$login = $user->attribute('login');
$email = $user->attribute('email');

and you can inspect $user using var_dump($user);

Modified on Monday 12 December 2005 9:21:35 am by Ɓukasz Serwatka

Monday 12 December 2005 3:38:42 pm

Thanks. If i do

echo var_dump($user);

this is what i get

object(ezuser)(9) { ["PersistentDataDirty"]=>  bool(false) ["Login"]=>  string(6) "carlos" ["Email"]=>  string(19) "carlos@desorden.net" ["PasswordHash"]=>  string(32) "a4a3b5e36b6918dab55b98fb4447e329" ["PasswordHashType"]=>  string(1) "2" ["Groups"]=>  NULL ["OriginalPassword"]=>  bool(false) ["OriginalPasswordConfirm"]=>  bool(false) ["ContentObjectID"]=>  string(3) "179" }

but that is not exactly what i'm looking for. I've made some changes to original user class. For example, i've added some fields to get the postal address and telephone number of the user. But i don't find the way to get the values of that fields.
As you say, i can get the email or the login of the user, but i can't find other fields...

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu