I recently decided to start using block caching on one of my sites and discovered an issue with the User's Points block. Basically, since it has no definition for the cache option, it defaults to BLOCK_CACHE_PER_ROLE as described at http://api.drupal.org/api/function/hook_block/6
The result is that all logged in users see the value that was last cached instead of their own points. To make this work, the block should be set to either BLOCK_CACHE_PER_USER or BLOCK_NO_CACHE.
Initially, I thought to just insert the cache bitmask as either per user or none, but then decided that it might be nicer to be able to set it via the edit interface for the block.
So, attached is a patch that adds that functionality. I included all the bitmask options although I don't know why anyone would want to use the others.
| Comment | File | Size | Author |
|---|---|---|---|
| userpoints.module.patch | 2.94 KB | fred0 |
Comments
Comment #1
berdirMy suggestion would be to fix the bug by changing to BLOCK_NO_CACHE and include a hook_update_N() function to fix existing installs. Because for BLOCK_CACHE_PER_USER, we'd also have to think about clearing the cache when the points change...
Comment #2
manuel.adanClosing this as outdated, 6.x version is no longer maintained.