I'm having an issue whereby clearing Civi cache is the only way to make some fields visible on a Drupal 7 user profile. I've tried to debug the issue and it seems to be caused by anonymous users viewing the account, where they don't have the permission to view those fields and it caches that result of seeing nothing.

My issue for now however, is that in Drupal's sites/default/civicrm.settings.php file, I've set the cache to:

  define('CIVICRM_DB_CACHE_CLASS', 'NoCache');

I've debugged it and check that CIVICRM_DB_CACHE_CLASS has not already been defined but Civi is still caching those results. How can I fix this or how else can I turn off Civi caching?

Logged in as admin, this is what the profile looks like before clearing caches: Missing fields before cache clear

And then after clearing caches: Fields after clearing cache

  • It sounds like your issue is compiled Smarty templates, not traditional caching. Could you edit your question to include a screenshot so folks can better assess? Jan 29, 2020 at 12:22
  • Of the fields that would be missing or the templates_c directory? TIA for helping Jan 29, 2020 at 14:09
  • A screenshot of the missing fields. You can also try deleting templates_c and immediately reload the page. If you see a difference, we've isolated the problem and can work on finding the root cause. Jan 29, 2020 at 20:27
  • Annoyingly, the cache is behaving itself this morning, it wasn't yesterday. So, I might need to follow this up later today/tomorrow. Jan 30, 2020 at 10:45
  • I tired clearing down the templates_c directory but it didn't seem to do anything. When I've stepped through it with xdebug it doesn't seem to make any contact with templates_c, only the civicrm_cache table. But I've edited for those screenshots now. Jan 31, 2020 at 9:25


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.