the current dev version of prev_next_views module do not actually work, for 2 reasons:

1. in hook_views_pre_execute() it tries to get the nid list of current view, but the result returned by execute() is not an array of rows in Drupal 7. so the list will not be made and will not be saved in the session.

2. after fixing the previous issue, you'll find that sometimes the saved session variable is reset immediately, which is in hook_node_load(). Basically It tries to find if the nodes loaded belongs to the nids saved in the session variable, if not, it will empty the session variable. However, it means when you have some other node loaded on the same page that do not belong to the view, the session is cleared immediately.

the fix is in the patch attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexku’s picture

1. as far as my testing shows execute() returns an object of type DatabaseStatementBase, which extends PDOStatement, which implements Traversable, which is traversable in foreach.

The current code in the repository has been working fine for at least half a year on a live website. What version of Drupal are you on?

2. makes perfect sense. Thank you. Can we just abandon session clearing?

P.S. your patch is not against the latest commit in the repository

jmdall’s picture

Issue summary: View changes
FileSize
1.08 KB
727 bytes

I don't really understand why it's doesn't work for me but I've this error when trying to display a node with a view (Views 3) using Search API :
PHP Fatal error: Call to a member function execute() on a non-object

I've done some modifications to make it work for me, changing prev_next_views_views_pre_execute to prev_next_views_views_post_execute.

Why use the views_pre_execute to get the nids, if you can have it in the views_post_execute ?
I've tried to figure it out but haven't...!

You'll find my patch attached and an interdiff.