Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I'm using the flags module with tokens to count the number of users that flagged content.
For example:
Like ([comment:flag-comment-likes-count])
This works fine when Drupal caches are disabled, no JS compressions, etc. It shows "Like (14)" etc.
But once you turn on these caches, the token often breaks and looks like "Like ([comment:flag-comment-likes-count])" on the frontend.
Is this a flag issue, a token issue, or...?
Comments
Comment #1
Dave ReidYou would have to ask Flag module as we don't provide the token that either calls token_replace() nor provides the code that provides the values for flag tokens.
Comment #2
quicksketchI can't confirm this problem. I set up a flag that was available to anonymous users (after enabling Session API) with the string "Flag as offensive ([comment:flag-offensive-comment-count])". Where the machine name of my flag was "offensive_comment". Everything worked just fine with the anonymous page cache enabled, both as a logged in user and as a logged out user. This was against the latest dev release of Flag though, perhaps something has been fixed since the last official release.
Comment #3
quicksketchMarked this issue as duplicate (pretty much the exact same symptoms): #1234874: Tokens in flags texts breaks often when Drupal caches enabled
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commented@quicksketch, will try to test again soon. In my case it happened for logged in users, we were using Memcached.
Comment #5
quicksketchPerhaps it's unfair that I hadn't responded to this issue in a long time and now I'm impatient, but normally I'd close an issue after 2 weeks at maintainer needs more info. If you need more time you can reopen the issue again later, but for now I'll let this go a while more.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedHi in #3 this issue was marked as a duplicate of itself. Was there another thread you meant to reference?
You can close this and I'll file a new issue if it happens again.
Comment #7
quicksketchYes I meant to link to #1185528: Flags, token and cache don't work well, which was the issue marked duplicate.
Comment #8
Jessica A CreditAttribution: Jessica A commentedI have this issue as well.
It also displays the token's name i.e. "[node:flag-vote-count]" on the node creation preview page.
Comment #9
a.siebel CreditAttribution: a.siebel commentedI have this issue too.
I think it only appears in my (flagged) views embedded in panels. (I thougth wrong)In some views I can't flag content if the view is cached - But not sure, what is the condition.
Comment #10
joachim CreditAttribution: joachim commentedClosing old bugs where no further information was supplied.