fetching User data

Author Message

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

Carlos Revillo

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...

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 19 2025 21:33:54
Script start
Timing: Jan 19 2025 21:33:54
Module start 'layout'
Timing: Jan 19 2025 21:33:54
Module start 'content'
Timing: Jan 19 2025 21:33:54
Module end 'content'
Timing: Jan 19 2025 21:33:54
Script end

Main resources:

Total runtime0.0206 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 589.0313152.6094
Module start 'layout' 0.00610.0034 741.640639.4141
Module start 'content' 0.00960.0088 781.054789.3984
Module end 'content' 0.01840.0022 870.453134.3047
Script end 0.0206  904.7578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002713.2901140.0002
Check MTime0.00126.0353140.0001
Mysql Total
Database connection0.00104.993610.0010
Mysqli_queries0.003215.592830.0011
Looping result0.00000.077410.0000
Template Total0.00178.210.0017
Template load0.00094.388410.0009
Template processing0.00083.826010.0008
Override
Cache load0.00063.008410.0006
General
dbfile0.00021.208080.0000
String conversion0.00000.048540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs