From several forum posts, it seems that the correct way to disable cache when a user is logged in is to place this in the config.php file:
But I just found out a side effect from this when implementing the Kirby Algolia plugin.
For the Algolia plugin I need to specify the search index to be used. For the production site I have one index, and for the development version I have another index:
So by using this multi-environment setup I can overwrite the index setting on my local dev version.
This way of overwrite some config values works fine, until you have this code in your config.php:
// Deactivate cache settings etc...
As soon as the line
site()->user()runs in the config.php, any config setting in my
config.localhost.php won’t overwrite anymore. So in my case, setting a different Algolia index on my local dev installation has no effect.
I have tried this with a fresh install of the Starterkit, and I can’t figure out what is wrong. But I guess that
site()->user() does something in the background that prevents config settings to overwrite older settings.
So my question is two fold.
- Is this a bug that
site()->user() prevents overwriting of config settings?
- Is there another way to disable cache if a user is logged in?