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.
I've spotted this while working on something else. Filing this for further investigation later.
flag_get_user_flags() has these conditions for getting all the flagging data for an entity:
->condition('entity_type', $entity_type)
->condition('entity_id', $entity_id)
->condition(db_or()
->condition('uid', $uid)
->condition('uid', 0)
)
->condition('sid', $sid)
So it allows for global flags, where the uid is 0. If you happen to be anonymous, then the two conditions in the 'or' are identical, and that's fine too.
But if you're an anonymous user, you have a non-zero sid. Meanwhile, any global flag records a 0 for both the uid and the sid.
So if there is also a global flag on the entity, and you're anonymous, it won't show up.
Comments
Comment #1
joachim CreditAttribution: joachim commentedLooks like this was introduced in #1258764: Flag starts a session on anonymous user loads which is bad for pressflow/varnish.