This is a follow-up to https://github.com/backdrop-contrib/uc_price_per_role/issues/5.
The problem
By default, Backdrop caches various entities, notably nodes. (This was not done by default in D7.) There are situations, though, where the content and/or display of a node depends on the user; for example, anonymous and authenticated users might need to see somewhat different pages. The always-caching of nodes in Backdrop breaks the behavior of sites that relied on the ability to distinguish between users when rendering nodes in D7. A few examples:
If a site uses Token Filter module and includes any user-dependent tokens, e.g., [user:name], in the node body, all users (both anonymous and authenticated) will see the name of the user who viewed the page at the time it was cached.
In Ubercart sites, the UC Price per Role module charges different prices to different users, depending on their role. In Backdrop, all users see the same price, which is the price that was given to the user who viewed the page at the time it was cached.
In the User Time Zone Tokens module, one of the settings for time zone tokens is "Use user's timezone for authenticated users, browser's timezone for anonymous users." This is broken on Backdrop because the rendered time zone-specific time is getting cached as part of the node.
What is needed is the ability for site admins to disable entity caching, ideally with sufficiently fine-grained control so that one can only disable it where it makes a difference, but can leave it on elsewhere for performance gains.
Suggested change
On the Performance configuration page at admin/config/development/performance
, there is a fieldset for Caching that allows "Cache pages for anonymous users." I suggest we add a section here that lists all entities and offers checkboxes for both "Cache entitytype for anonymous users" and "Cache entitytype for authenticated users", and then we respect these settings in DefaultEntityController::load() when dealing with the persistent cache.
Related issues:
- [Remove field data sanitization from hook_field_load()](https://github.com/backdrop/backdrop-issues/issues/5642 (Drupal core patch)
Recent comments
After alot of trials, i have done the obvious and translated the whole block for different languages with each property condition as follows: ->propertyCondition('langcode', 'en...
How to get the current page language?
Thanks so much! It's working now: I was able to transfer the docroot files to the containing directory without the need for a second database or any manual configuration export/import/sync...
Backup & Migrate Config: There was a problem creating field...database table with the name already exists.
Ah, I see. Sorry, I hadn't clicked the link and assumed it was the instructions for upgrading from Drupal 7. If you are simply copying a site from one location on a server to another, the...
Backup & Migrate Config: There was a problem creating field...database table with the name already exists.