Displaying wrong username

Author Message

John Petrello

Monday 10 January 2011 12:11:11 pm

So, I have a passworded section of a clients website (using eZPublish 4.0.1). When I login, it doesn't always output the correct username. Then, as I navigate to other pages, it sometimes gets the username right, sometimes doesn't. A temporary fix a co-worker has spotted is clearing the cache. It works until you log out and back in.

Here is the code I have that gets and displays the username:

{def $userInfo = fetch( 'user', 'current_user' )}

{if ne($userInfo.contentobject_id, 10)} <p>{"Welcome back, "|i18n('anvil')}{def $userInfo = fetch( 'user', 'current_user' )} {if ne($userInfo.contentobject_id, 10)} <p>{"Welcome back, "|i18n('anvil')}

...

Please let me know if simply upgrading the eZPublish to a later version is all thats required or if there is already a bugfix.

Thanks!

Edi Modrić

Monday 10 January 2011 12:31:25 pm

Hi John,

this sounds to me like a wrongly set up cache block that's interfering.

Adding the $userInfo.contentobject_id to your cache block keys array should sort this out.

eZ Publish certified developer

http://ez.no/certification/verify/350658

John Petrello

Monday 10 January 2011 12:55:47 pm

Could you go into more detail please? I am very new to eZPublish.

André R.

Tuesday 11 January 2011 12:30:31 am

He is basically saying that you have some cache in place where the name is outputed.

Could be cache-block, a template (.tpl) block that makes sure dynamic templates are cached to static html to not have to re generate the block on every request (to improve performance).

You can debug templates by enabling site.ini [TemplateSettings]ShowUsedTemplates=enabled & DevelopmentMode=enabled and other settings.
Take a look on doc.ez.no to see how to work with ini files and overriding them, and to see the different settings you have available in site.ini.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

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 05:08:33
Script start
Timing: Jan 18 2025 05:08:33
Module start 'layout'
Timing: Jan 18 2025 05:08:33
Module start 'content'
Timing: Jan 18 2025 05:08:35
Module end 'content'
Timing: Jan 18 2025 05:08:35
Script end

Main resources:

Total runtime1.4822 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.0068 587.9141152.6250
Module start 'layout' 0.00690.0056 740.539139.4531
Module start 'content' 0.01241.4685 779.9922593.8906
Module end 'content' 1.48090.0012 1,373.882812.4766
Script end 1.4822  1,386.3594 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2236160.0002
Check MTime0.00150.0984160.0001
Mysql Total
Database connection0.00150.099810.0015
Mysqli_queries1.426896.2589630.0226
Looping result0.00060.0424610.0000
Template Total1.439197.120.7195
Template load0.00210.140720.0010
Template processing1.437096.946320.7185
Template load and register function0.00010.008410.0001
states
state_id_array0.00190.130410.0019
state_identifier_array0.00280.190920.0014
Override
Cache load0.00180.1187270.0001
Sytem overhead
Fetch class attribute can translate value0.00050.032730.0002
Fetch class attribute name0.00100.064760.0002
XML
Image XML parsing0.00120.078530.0004
class_abstraction
Instantiating content class attribute0.00000.000960.0000
General
dbfile0.00110.0762230.0000
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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1content/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: 17
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs