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.
the user is not logged in, but in block New forum topics - display link "Configure block"
Comment | File | Size | Author |
---|---|---|---|
#21 | 1223324-contextual-block-cache.patch | 903 bytes | franz |
#9 | 1223324-forum-block-cache.patch | 693 bytes | franz |
15.jpg | 138.92 KB | protools |
Comments
Comment #1
franzProper component
Comment #2
franzI was able to reproduce, I'll investigate further.
Comment #3
franzSteps to reproduce:
1. Fresh install
2. Enable forum module
3. Move block "new forum topics" to first sidebar
4. Access home as anonymous
Comment #4
protools CreditAttribution: protools commentedI first saw this bug when using the theme of "Omega" after switching theme bug persists for a while, then disappears
Comment #5
franzContextual links are being cached for this block, apparently.
EDIT: clear cache and reload page as anonymous user, the link is gone.
Comment #6
franzConsistently, after doing #5, reload page as admin and the link will also be gone.
Comment #7
protools CreditAttribution: protools commentedand ? bug of Omega? when use Omega i see this every log out. I clear cash and reload page on Omega but link don't gone.
Comment #8
franzNo. The bug is in forum module.
Comment #9
franzI found a solution. The block can be cached by role, and this solves issues with contextual links permissions.
Comment #10
franzComment #11
protools CreditAttribution: protools commentedpatch work fine
Comment #12
franzAdding "Needs tests", but actually the test case would be to check contextual links on cached blocks.
Comment #13
protools CreditAttribution: protools commentedwhen logged link "configure block" there is. when log out link is gone. look like good ...
Comment #14
franzComment #15
catchWhere are the contextual links being added from? If it's block module or contextual module those modules should fix the caching rules.
Comment #16
franzcatch, the forum module does a custom cache handling, which means other modules won't affect it at all. It renders the full block an cache it for himself. I don't know the reason for this behavior, but I doubt there is anything contextual.module can handle.
Comment #17
catchIf forum isn't handling the contextual links, it should be responsible for the caching changes. In fact forum doesn't use block caching at all so that makes this even more the case.
Comment #18
catchOK reviewed the code a bit.
forum module does not do anything about contextual links.
block module adds contextual links in _block_get_renderable_array().
Really it's here that it should force the renderable array to be cached per role, this would mean altering the cache key provided by forum module.
Otherwise every block that does it's own caching_block_get_renderable_array also needs to be cached per role, not just forum module.
Comment #19
franzActually, if you want to pull it into a more generic fix, then the very presence of contextual module would completely invalidate any DRUPAL_NO_CACHE block. This is not at all bad, but I'm unsure where exactly this should get implemented. If my assumption is true, there could be a well documented hook_block_alter implementation on contextual.module to make this change, as it would be easy to find and understand later.
Comment #20
franzUgh, name it all wrong.
That's DRUPAL_CACHE_GLOBAL and not DRUPAL_NO_CACHE. Also, I believe DRUPAL_CACHE_PER_PAGE is also affected.
And that's hook_block_info_alter().
Comment #21
franzThere you go.
Comment #23
sunWanted to roll a new patch, but this is getting a lil bit tricky...:
Comment #24
franzDoesn't node access restriction disable block cache globally?
Comment #25
catchSorry this is actually a duplicate of #914382: Contextual links incompatible with render cache.
Comment #26
droplet CreditAttribution: droplet commentedREAD: http://drupal.org/node/914382#comment-4792776
Comment #27
catchSee my comment there too, there may have to be a generic fix and a one off hack, but it is the same bug with contextual module do let's keep it in one place please.