display current_user main_node_id in php

Author Message

ludo thomas

Friday 06 January 2006 3:06:34 am

Hi !
I need to access to the main_node_id in checkout.php
I use:

$user=& eZUser::currentUser();
$userId=$user->attribute('contentobject_id');

So I have the user ID but how to have the user's main node?

thx

Kristof Coomans

Friday 06 January 2006 5:29:57 am

$user =& eZUser::currentUser();
$userContentObject =& $user->attribute( 'contentobject' );
$mainNodeID = $userContentObject->attribute( 'main_node_id' );
$mainNode =& $userContentObject->attribute( 'main_node' );

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

ludo thomas

Friday 06 January 2006 6:04:54 am

hi kristoff, & thx for your reply,I tried this before but your code doesn't dislay nothing...
any idee?
does it display something with you?

Kristof Coomans

Saturday 07 January 2006 9:12:58 am

What do you get with:

var_dump( $mainNode );
var_dump( $mainNodeID );

after the code I gave you already?

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 21:05:56
Script start
Timing: Jan 18 2025 21:05:56
Module start 'layout'
Timing: Jan 18 2025 21:05:56
Module start 'content'
Timing: Jan 18 2025 21:05:57
Module end 'content'
Timing: Jan 18 2025 21:05:57
Script end

Main resources:

Total runtime0.8247 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 589.1797152.6406
Module start 'layout' 0.00540.0026 741.820339.4766
Module start 'content' 0.00800.8152 781.2969554.0547
Module end 'content' 0.82320.0014 1,335.351612.1250
Script end 0.8246  1,347.4766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.3707160.0002
Check MTime0.00120.1513160.0001
Mysql Total
Database connection0.00090.107310.0009
Mysqli_queries0.776294.1202600.0129
Looping result0.00050.0615580.0000
Template Total0.796596.620.3983
Template load0.00210.249920.0010
Template processing0.794596.335320.3972
Template load and register function0.00010.009010.0001
states
state_id_array0.00080.096210.0008
state_identifier_array0.00100.119820.0005
Override
Cache load0.00170.2036230.0001
Sytem overhead
Fetch class attribute can translate value0.00040.052820.0002
Fetch class attribute name0.00100.120660.0002
XML
Image XML parsing0.00080.092920.0004
class_abstraction
Instantiating content class attribute0.00000.002180.0000
General
dbfile0.00080.0915220.0000
String conversion0.00000.000840.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
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 20
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs