Problem/Motivation
When the anonymous page cache is enabled (or Memcache module is enabled and $conf['page_cache_without_database'] = TRUE; in settings.php), a message isn't showing for anonymous users. The reason for it is /conditional_message_data_output returns nothing. That's is because the page is taken from the cache entirely.
And what do we put into the page cache?
$url = url('conditional_message_data_output', array('absolute' => TRUE));
cache_set($url, $data, 'cache_page');
It's an array instead of rendered content. And even if we render it, we still need to set the proper headers (eg content-type), right now the defaults are returned.
Comments
Comment #2
savel commentedComment #3
savel commentedHere is the simple patch that fixes the issue.
Comment #4
savel commentedI've created a more advanced patch that fixes full-page caching for anonymous users.
Comment #5
nikolas.tatianenko commentedWorks as expected!
Comment #6
savel commentedI've found a couple of notices with the latest patch. There's nothing serious but flooding at dev's logs. I will fix and return.
Comment #7
savel commentedHere is the patch. Slightly updated #4 by adding two default values to the cached array.
Comment #8
nikolas.tatianenko commentedWorks as expected.
Comment #9
savel commentedComment #10
savel commented7.x-1.x-dev was updated so the patch #7 no longer applies.
Rerolled against the latest dev.
Comment #11
nikolas.tatianenko commentedComment #13
savel commentedCommitted to 7.x-1.x. Thank you!
Comment #14
savel commented