Anonymous users see the exact same content in the "similar entries" block no matter the node or node type. Authenticated users find content in the similar entries block change as they access various nodes.

Comments

bryansd’s picture

This issue is observed when Drupal core's block cache is enabled and regardless of whether cache setting in similar entry module is enabled or disabled. Two possibilities might be:

  • Conflict between Drupal core cache and module's own cache settings.
  • Drupal core cache and module's own cache setting working by design. Perhaps though, this is an issue where block-level caching for the module needs to be changed to BLOCK_CACHE_PER_PAGE or even BLOCK_NO_CACHE via the hook_block? See: http://drupal.org/node/114774#block-cache

With block-level caching now available in Drupal 6 is there an advantage to this module having its own caching function?

deekayen’s picture

Assigned: Unassigned » deekayen

I wasn't aware of the new core block cache. You're probably right that the custom one can be removed.

deekayen’s picture

Status: Active » Needs review

I switched it to use BLOCK_CACHE_PER_PAGE | BLOCK_CACHE_PER_ROLE for HEAD in CVS:

http://drupal.org/node/95612

Whenever that updates, I'm interested in your feedback. Mark it reviewed and tested if you like it.

bryansd’s picture

As of this hour, the link you provided hasn't yet updated. I downloaded from the cvs, but may wait to comment further until I'm able to pull the actual update you've linked to.

I ran into a problem where the cache setting in the block table never changed from the default ( 1 for BLOCK_CACHE_PER_ROLE ). So, I disabled the similar module, deleted the database entry for the similar block in the block table, and then enabled the module again. When I enabled the module the correct block cache setting was set (5 for BLOCK_CACHE_PER_PAGE | BLOCK_CACHE_PER_ROLE ) and the similar module worked as desired. Some question whether this specific issue is due to additional D5 to D6 changes not recognized in the similar module or an issue with hook_block in the D6 core: http://drupal.org/node/235673 .

deekayen’s picture

What do you think about me adding an upgrade hook to do exactly what you did, remove and re-create the block entry.

bryansd’s picture

Deekayen: I think an upgrade hook would be beneficial.

The nightly snapshot ( http://drupal.org/node/95612 ) of the HEAD never seemed to update, but what I got from the CVS looks good so far. I've kept the status the same as you're likely needing additional review of the code.

idflorin’s picture

I tried the nightly snapshot and as you can see on adsneeze, nodes get the same similar entries.
I'm ussing:
- drupal's block cache
-for Similar entries module : Cache: Disabled.

That should I do ? (and please don't say to disable drupal's block cache)

deekayen’s picture

#7: please clarify - you're using nightly HEAD snapshot or 6.x-1.0? You mentioned snapshot, but marked 6.x-1.0. They use two different cache methods.

idflorin’s picture

I tried http://drupal.org/node/95612 and 6.x-1.0 official, but with no use. Finnaly I disable d6 block cache :(( and the similar module works perfect.
[I tried to hack into the similar.module with something like here http://drupal.org/node/277573#comment-905049, but no success, my php&drupal knowledge is limited]

parabiodox’s picture

bsimon’s picture

I encountered the same problem - anon users all see the same block on every page (unless I disable block cache)

BryanSD's solution does fix this (see http://drupal.org/node/253299#comment-829088), but I wondering if there's a more recent fix for this that I've missed. Surely there must be an simpler way to get the module working? Is there a dev version with the cache problem patch already incorporated?

For anyone else who has trouble, this was my solution:

1 Get the updated similar.module from http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/similar/sim... and replace the existing file in sites/all/modules/similar...
2 In Admin/modules - Disable Similar Entries module
3 You need something like PHPmyAdmin. Look in your database, the 'blocks' table. Look down the column titled 'module' and find the row with 'similar' - almost certainly it will be the very last one. Delete the entire row (If unsure about this, backup your database first).
4 Re-enable Similar Entries module, then go to admin/blocks to configure the Similar block - it should now be working for anonymous users

jellicle’s picture

I encountered the same problem, and confirm that bsimon's fix in comment #11 does work (eliminating the conflict between the two caches). Can we get a new release of this module with the CVS code since it does fix a showstopper bug?

deekayen’s picture

Status: Needs review » Fixed

Rather than deleting the entire similar row in the blocks table, just switch the similar row cache value from 1 to 5. This will happen automatically through an update function included in the next version. Look for a new release probably later today.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.