When I have used the Menu Token [current-user:account-name] for users , I have to flush all caches to display user name (capture.png)
when I log in with an other user, the name (name of previous user ) doesn't change. (capture2.png)
If I flush the cache with drush the name is empty. (capture3.png)

CommentFileSizeAuthor
Capture3.PNG25.85 KBimen ch
Capture2.PNG22.68 KBimen ch
Capture.PNG35.81 KBimen ch

Comments

imen ch created an issue. See original summary.

znak’s picture

Assigned: Unassigned » znak
znak’s picture

Status: Active » Postponed

I can't reproduce your problem. On my site it's work fine. Please, need more info.

imen ch’s picture

Do you have logged in with authenticated user or admin?
Do you have the correct name when you change the user?
For me it works only for admin after flushing all caches via drupal backoffice.

imen ch’s picture

Title: cache isuue » cache issue
imen ch’s picture

i tried on drupal 8.3.5 the token doesn't work even on role admin, the token has not been replaced

maaty388’s picture

For me token is not being replaced even for admin user

peter.draucbaher’s picture

Assigned: znak » peter.draucbaher
Status: Postponed » Needs work

Have to test with the updates.

peter.draucbaher’s picture

This is a hard one... Any idea will be appreciated. Drupal uses caching... and request is even not initiatiated. Items cannot be replaced.
Had to dig deeper in the caching system to solve problems on front page for anonim user.
https://drupal.stackexchange.com/questions/201273/problem-with-event-sub...

It goes hand in hand with performance. It is a double edge sword... If caching is disabled performance will go to to he...

peter.draucbaher’s picture

Will have to solve the problem with cache context and BubbleableMetadata object (new BubbleableMetadata())->setCacheContexts(['bar']). This will be the most elegant way.

https://medium.com/@joshirohit100/cache-context-drupal-8-part-1-55303ec665ce
https://medium.com/@joshirohit100/cache-context-drupal-8-part-2-10088f67012e

https://www.youtube.com/watch?v=GSin_1jEyec

peter.draucbaher’s picture

Time for extensive testing.

peter.draucbaher’s picture

Status: Needs work » Needs review
peter.draucbaher’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

reflie’s picture

Hmm, seems that this issue isn't fixed. I can still reproduce it using latest module version (1.x-dev) and latest Drupal version (8.5.1).