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 can't seem to get this module working properly for anonymous users when using block cache (I'm using a module, Form Block, that I use to place a node/add form into a block).
It will on the initial page load but after a refresh, it no longer works even after flushing the cache.
Any ideas on a workaround?
Comments
Comment #1
Steve Dondley CreditAttribution: Steve Dondley commentedJust to clarify, with block caching turned off, it works great.
Comment #2
Steve Dondley CreditAttribution: Steve Dondley commentedOK, found a work around by using the Block Cache Alter module: http://drupal.org/project/blockcache_alter
Comment #3
sunThis cannot be resolved until D7, which has built-in support for the block caching scenario.
Comment #4
doublejosh CreditAttribution: doublejosh commentedI use Block Cache Alter but still have this problem. What is the workaround?
Thanks!
Comment #5
JvE CreditAttribution: JvE commentedComment #6
Rob_Feature CreditAttribution: Rob_Feature commentedI'm not sure if it's block cache or not, but I'm seeing this behavior with Varnish caching. I'd like to try this solution by altering block cache to see if it helps...can someone explain what needs to be done, please?
Comment #7
kris_mcl CreditAttribution: kris_mcl commentedI'm also having problems with Compact Forms & block cache in Drupal 7.17 with compact_forms 7.x-1.0. compact_forms.js generally doesn't load with block cache turned on, though it sometimes works immediately after clearing the site cache or running cron.
I'd also love to see a fix for this or an explanation of how to use the Block Cache Alter.
Thanks!
Comment #8
oriol masjuan CreditAttribution: oriol masjuan commentedBasically the problem is that when the block is cached drupal does'nt call any more the hook_form_alter (of the compact form) that adds a class to the block.
A reasonable solution is to create a module that disables the cache for that specific module.
Here is teh code
/**
* Implements hook_block_info_alter().
*/
function YOURMODULENAME_block_info_alter(&$blocks, $theme, $code_blocks) {
$blocks['mailchimp_lists']['newsletter']['cache'] = DRUPAL_NO_CACHE;
}
Comment #9
fox mulder CreditAttribution: fox mulder commentedThank You omasjuan, Your solution works great!
(
where the error occured:
Compact Forms 7.x-1.0
Drupal 7.26
Block cache switched On
)
Comment #10
G2 CreditAttribution: G2 commentedAn addition for omasjuan solution: you should always check if the block exists in block info alter, if you disable the module later or delete the block it will throw an error which is really hard to debug (run into this issue)