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.
If I create a node and leave it unpublished, the node before it will have a next link to the new node. I must re-index (and run cron) to correct it.
Comment | File | Size | Author |
---|---|---|---|
#7 | prev_next-only_allow_published_nodes-1074338-6.patch | 1.04 KB | energee |
#6 | 1074338.prev_next.patch | 604 bytes | dagmar |
#5 | prevnext-unpub-1074338-5.patch | 703 bytes | aasarava |
Comments
Comment #1
trothwell CreditAttribution: trothwell commentedconfirmed
Comment #2
trothwell CreditAttribution: trothwell commentedI'd just like to comment down that a fix i've been trying to work on actually defeats the purpose of this module so i'm not going to bother continuing to attempt a patch. Slim and fast queries is what the goal was.
I attempted to add a while loop with an inner join going through each entry until it finds the appropriate one. It just doesn't work entirely well. The only other thing i can think off is to add a rebuild on every cron run and have the cron run on a regular basis.
For anyone who is interested here is my first attempt (should be replicated to the prev function as well):
Comment #3
tribsel CreditAttribution: tribsel commentedthis is pretty serious, if you unpublish node, you break prev/next navigation, in my case. Because anonymous user does not have rights to view unpublished nodes, he gets redirected to login/register screen. One unpublished node makes this whole api useless.
Comment #4
askibinski CreditAttribution: askibinski commentedMy first thought is this could be solved by adding this functionality.
1. skip indexing unpublished nodes in the first place
when a node is unpublished:
2. remove a node from the prev_next table
3. replace his siblings with the new reference
tricky part might be when an old unpublished node is published:
4. find out where he belongs and basically undo steps 2 and 3.
But I guess there might be already a mechanism for #4.
Comment #5
aasarava CreditAttribution: aasarava commentedI put together this simple patch that seems to work in my testing.
Comment #6
dagmarThe patch works fine. Updated respecting coding standards and using git.
Comment #7
energee CreditAttribution: energee commentedFor Drupal 7 Branch
Comment #8
idflorin CreditAttribution: idflorin commentedThanks #7. It works for 7.x version.
Comment #9
gkom CreditAttribution: gkom commentedI confirm that patch #7 works in 7.x. Thank you very much!
Comment #10
energee CreditAttribution: energee commentedYou're welcome!
Comment #11
bhosmer CreditAttribution: bhosmer commentedIs this still an issue in the latest 6.x? If it is, feel free to reopen, although support for Drupal 6 is nearing an end.
Comment #12
garbo CreditAttribution: garbo commentedThis still seems to be an issue for prev_next 7.2.x
EDIT: sorry, I was actually using prev_next 7.x.1
Comment #13
garbo CreditAttribution: garbo commentedI just tested 7.2.x and I can confirm that this problem still presists in prev_next 7.2.x
Comment #14
garbo CreditAttribution: garbo commentedThe patch from #7 seems to do the trick.
Comment #15
bhosmer CreditAttribution: bhosmer commented@garbo:
Thanks for updating this issue. Could you perhaps roll the patch against 7.x-2.x and post it?