Forums / General / fetching User data
Carlos Revillo
Friday 09 December 2005 12:56:46 am
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.
Ćukasz Serwatka
Monday 12 December 2005 12:20:35 am
Hi Carlos,
Use code:
$login = $user->attribute('login'); $email = $user->attribute('email');
and you can inspect $user using var_dump($user);
Personal website -> http://serwatka.net Blog (about eZ Publish) -> http://serwatka.net/blog
Monday 12 December 2005 6:38:42 am
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...