Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
The Prev/Next data is not updated when a node becomes unpublished, resulting in users navigating to "Access Denied" pages when the link still points to the original content.
Comments
Comment #1
dysproseum CreditAttribution: dysproseum commentedCreated a patch to address the issue. The module will now remove a node from the prev_next_node table when it is unpublished, and reassign nodes that linked to it.
Also, when a node is published again, it will be re-added to the prev_next_node table, and become re-included in links to other content.
Testing example:
Comment #2
dysproseum CreditAttribution: dysproseum commentedComment #3
dysproseum CreditAttribution: dysproseum commentedUpdated patch to match coding standards.
Comment #4
dysproseum CreditAttribution: dysproseum commentedUpdated patch to unset prev_nid and next_nid values when their NID values become unpublished.
Prevents an issue that can leave links to unpublished nodes in some cases.
Comment #5
xumepadismal CreditAttribution: xumepadismal as a volunteer commentedUpdated patch fixes issue when the node is being *inserted* as unpublished
Comment #6
tim-dielsTested latest patch and works like expected. Good job!
Comment #23
Rob C CreditAttribution: Rob C commentedNeeds reroll.
Comment #24
marttir CreditAttribution: marttir at Avoltus Oy commentedThe patch from #2774825 would conflict with the one in #5.
Since I'm in a bit of a hurry, I took the liberty of rolling both up into this patch against current 2.x-dev.
The first and second hunks of #5 were skipped; the second one seems to do what _prev_next_modify_pointing_nodes() already did, but with reverse lookup. Reviewer might want to take an extra look at this just to make sure.
With quick testing, references are updated as expected when unpublishing/publishing nodes in the middle of a chain, when adding a new node at the end of the chain, and when adding a published node in the middle of the chain.
Comment #25
marttir CreditAttribution: marttir at Avoltus Oy commentedComment #30
pribeh CreditAttribution: pribeh commentedHi, thanks for your efforts here. Have you been able to incorporate any of @dysproseum's efforts into this patch?
https://www.drupal.org/node/2464065
Comment #31
marttir CreditAttribution: marttir at Avoltus Oy commented#24 includes @dysproseum's efforts from this issue, as well as @ethan.han777's efforts from #2774825.
@dysproseum's cron patch from #2464065 is not included here as it's kind of an unrelated issue: links to unpublished nodes should never occur with #24, but they may happen if other modules use too much magic when publishing/unpublishing nodes. Also, since the cron patch only adds a bit of code, rerolling it seems straightforward.
Comment #32
marttir CreditAttribution: marttir at Avoltus Oy commented