- Issue created by @ab_connor
- 🇩🇪Germany jurgenhaas Gottmadingen
This is due to caching. As you're using the "View content entity" event, this won't be triggered once that entity got viewed once, e.g. by an authenticated user, and therefore got cached. That's why it will be in cache and Drupal delivers the cached version the next time this entity is being requested.
You can resolve this by either invalidating the cache for such nodes, or you change the event to react upon. In the ECA Guide library, there is an example which redirects users on 403 to the login page, you may want to download that and modify that towards you requirements.
- 🇩🇪Germany ab_connor
Thanks for your support. I tried to invalidate the cache for nodes from type "event" by using the task "cache invalidate". But I'm not really familiar with cache keys. What would be the right entry for it? I tried "entity_view" and some others without any success. And can I use "node:[entity:nid]" in the tags field for a granular invalidating?
- 🇩🇪Germany jurgenhaas Gottmadingen
I thought about it again and the cache invalidation approach isn't what I should have suggested. Going with the redirect sample is certainly a better way.
A third option might be the eca_access module. That way you could define different access rules depending on user role.
- Status changed to Postponed: needs info
over 1 year ago 1:52pm 9 March 2023 - Status changed to Fixed
over 1 year ago 8:00am 10 March 2023 Automatically closed - issue fixed for 2 weeks with no activity.