eZ Community » Forums » Setup & design » User Cache problem
expandshrink

User Cache problem

User Cache problem

Friday 23 September 2011 11:04:43 am - 3 replies

hi there,

so, i'm having problems with the current_user function..

this is the case:

i show differents articles to the users, if they have a checkbox attribute set to true.

the problem is, when i want to get the current user (using the current_user fetch) in template, i get the last logged user, but in pagelayout template the fetch works as it shoulds.

of course, if a clear the cache, i get the right user in both templates.

i also change the user_hash, and even if the page have an other user_hash, i still have the same trouble.

what i am doing wrong?

Friday 23 September 2011 11:26:28 am

I bet "problem" is ViewCache. view cache is not per user but per role. so, when a new user loads the page, cache is not regenerated for it if another cache file for a user of the same role exists.

And cache makes current_user function not execute at all 

So, if the thing is for  a small number of nodes, maybe you may want to take a look at 

https://github.com/ezsystems/ezpublish/blob/master/settings/site.ini#L1112

Friday 23 September 2011 12:57:54 pm

aha! that's exactly i was looking for. thx

Wednesday 14 March 2012 7:42:40 pm

.. or add this in pagelayout where the problem occurs

{cache-block keys=array( $current_user )}
   ...  code 
{/cache-block}

Modified on Wednesday 14 March 2012 7:46:40 pm by Fabio G.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from