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.