Forums / Developer / How can find a user groups grandparent?

How can find a user groups grandparent?

Author Message

Brendan Pike

Thursday 28 October 2004 2:40:02 am

How can I find the grandparent of a users usergroup? I did find the below article but I wasn't able to convert it for my need. Any help much appreciated.

http://ez.no/ez_publish/documentation/incoming/how_to_find_the_parent_and_grandparent_of_an_object

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.

Hans Melis

Thursday 28 October 2004 3:17:37 am

Hi Brendan,

The article you linked to takes a rather large detour to find the grandparent of a node. The following code snippet should give you the grandparent:

{$node.parent.parent}

If you want the object, it's similar to accessing the object of the current node

{let grandparent=$node.parent.parent}
  {$grandparent.object|attribute(show)}
{/let}

hth

Hans
http://blog.hansmelis.be

Brendan Pike

Thursday 28 October 2004 5:53:09 am

Thanks Hans
Doesn't work for me though, I'm inside the edit_attribute.tpl This works for me

group_id=$current_user.contentobject.main_parent_node_id

But this is only the parent not grandparent of course. Any other ideas?

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.

Hans Melis

Thursday 28 October 2004 8:38:33 am

Aha, you want it directly for a user. You need an additional fetch then.

{let parentNode=fetch('content','node',hash('node_id',$current_user.contentobject.main_parent_node_id))
     grandparent=$parentNode.parent}
{$grandparent.name|wash}
{/let}

Once you have a node, it's similar to what I wrote in my first reply. If you have an object (like $current_user.contentobject), then you need to find a node first.

Hans
http://blog.hansmelis.be

Brendan Pike

Thursday 28 October 2004 9:03:27 am

Nope your code still didn't work for me :(
Just got the following errors,
Unknown template variable 'parentNode' in namespace ''
Unknown template variable 'grandparent' in namespace ''
The mystery continues

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.

Hans Melis

Thursday 28 October 2004 9:07:48 am

You're using a namespace then. Try using $: instead of just $ in front of the variables.

Hans
http://blog.hansmelis.be

Brendan Pike

Thursday 28 October 2004 9:27:17 am

Yup your right, think I'd better go to bed.

Works nicely now, many thanks :-)

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.

eZ debug

Timing: Jan 19 2025 19:01:43
Script start
Timing: Jan 19 2025 19:01:43
Module start 'content'
Timing: Jan 19 2025 19:01:44
Module end 'content'
Timing: Jan 19 2025 19:01:44
Script end

Main resources:

Total runtime1.5464 sec
Peak memory usage4,096.0000 KB
Database Queries206

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0100 589.0547180.8281
Module start 'content' 0.01001.3919 769.8828584.7891
Module end 'content' 1.40190.1444 1,354.6719341.0859
Script end 1.5463  1,695.7578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00430.2763210.0002
Check MTime0.00150.0984210.0001
Mysql Total
Database connection0.00080.051410.0008
Mysqli_queries1.457494.24862060.0071
Looping result0.00200.12692040.0000
Template Total1.495096.720.7475
Template load0.00240.152420.0012
Template processing1.492696.523920.7463
Template load and register function0.00020.013710.0002
states
state_id_array0.00190.120910.0019
state_identifier_array0.00190.122220.0009
Override
Cache load0.00200.1307350.0001
Sytem overhead
Fetch class attribute can translate value0.00150.097630.0005
Fetch class attribute name0.00090.061280.0001
XML
Image XML parsing0.00100.064630.0003
class_abstraction
Instantiating content class attribute0.00000.0015100.0000
General
dbfile0.00420.2734260.0002
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 29
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs