Hi,

I've used the Drupal 7 port in one of the other issues to create my own implementation of prev/next. I stumbled upon a problem with the index not correctly being updated when a node is deleted. hook_delete is called before a node is deleted, so the node is still in the node table. The _prev_next_add() function will search the node table to update nodes that point to the "to be" deleted node. In my case the "to be" deleted node is again found as the node to point to.

In example:
I have node 1, 2, 3 and 4. I delete node 3. Node 2 and 4 should be updated to point to each other. However, node 3 is still found in the node table. The results is that I have a prev/next link showing "[node:title]" with the URL node/3 on both page 2 and 4.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gkom’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

This also happens in the current 7.x-1.x-dev. Has anybody managed to fix this?

xumepadismal’s picture

Here is the patch. It writes removed NIDs to _SESSION instead of instant re-indexing and makes re-index on hook_init.

xumepadismal’s picture

Status: Active » Needs review
bhosmer’s picture

Status: Needs review » Reviewed & tested by the community
Related issues: +#1986930: Prev/next links depends on taxonomy term referenced to node

RTBC. Also, related to #1986930 and added to that patch.

bhosmer’s picture

Does anyone want to re-roll this for the 7.x-2.x branch? It doesn't apply cleanly now.

bhosmer’s picture

Status: Reviewed & tested by the community » Needs work