Problems with object_count_by_user_id

Author Message

Eivind Marienborg

Sunday 15 August 2004 6:55:25 am

I'm trying to use the object_count_by_user_id to show the number of forum-posts done by each user. I've inserted the following code in my forum_topic.tpl:

                        {let objcount=fetch( 'content', 'object_count_by_user_id',
                        hash( 'class_id', 45,
                        'user_id', $owner.main_node_id ) )}
                        {$owner.main_node_id}
                        <p>{$objcount} posts</p>
                        {/let}

It returns "0 posts" for all users, no matter how many posts they've actually done.. Any ideas as to why this doesn't work?

Paul Forsyth

Sunday 15 August 2004 1:50:05 pm

Check the permissions for the user making this request. It might not be allowed to access other users information. If you are the anonymous user then maybe you need to changes its permissions.

paul

--
http://www.visionwt.com

Eivind Marienborg

Sunday 15 August 2004 3:23:50 pm

It returns 0 when I'm logged in as Administrator User (with all rights) too, so it's got to be something else..

Paul Forsyth

Monday 16 August 2004 1:56:32 am

I tried this and it works for me.

I think your input to the function is wrong. You use $owner.main_node_id but i think it should be $owner.id.

paul

--
http://www.visionwt.com

Eivind Marienborg

Monday 16 August 2004 2:16:50 am

uuuh, that works great! Thanks! :D

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 20 2025 03:28:05
Script start
Timing: Jan 20 2025 03:28:05
Module start 'layout'
Timing: Jan 20 2025 03:28:05
Module start 'content'
Timing: Jan 20 2025 03:28:06
Module end 'content'
Timing: Jan 20 2025 03:28:06
Script end

Main resources:

Total runtime1.6287 sec
Peak memory usage4,096.0000 KB
Database Queries63

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0099 589.2734152.6406
Module start 'layout' 0.00990.0046 741.914139.4766
Module start 'content' 0.01451.6125 781.3906526.9063
Module end 'content' 1.62700.0016 1,308.296912.1406
Script end 1.6286  1,320.4375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2099160.0002
Check MTime0.00140.0829160.0001
Mysql Total
Database connection0.00110.066510.0011
Mysqli_queries1.560295.7949630.0248
Looping result0.00110.0652610.0000
Template Total1.562095.920.7810
Template load0.00210.126420.0010
Template processing1.559995.778320.7800
Template load and register function0.00010.007610.0001
states
state_id_array0.00240.148510.0024
state_identifier_array0.00520.319920.0026
Override
Cache load0.00180.1076240.0001
Sytem overhead
Fetch class attribute can translate value0.00080.051520.0004
Fetch class attribute name0.00110.067960.0002
XML
Image XML parsing0.00050.028420.0002
class_abstraction
Instantiating content class attribute0.00000.001180.0000
General
dbfile0.01120.6863160.0007
String conversion0.00000.000740.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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs