Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jarviss’s picture

subscribe

Canadaka’s picture

subscribe

unless is there a better way or another existing module in D7 for prev/next links?

basicmagic.net’s picture

subscribe

MGParisi’s picture

subscribe

jdanthinne’s picture

Status: Active » Needs review
FileSize
13.66 KB

Hi,
I needed it too, so I've done a first port to D7, using Coder Upgrade and then fine-tuned it myself.
Using it on my own blog, and it's working fine, BUT I don't use the Views function, so this part needs to be checked.

BarisW’s picture

Looking good so far. It seems to work. The only thing I found is that the default text on the prev/next links is incorrect.

This is the default:

prev: [node:title] »
next: « [node:title]

Where it should be:

prev: « [node:title]
next: [node:title] »
jdanthinne’s picture

I haven't changed those values, they're the same as the D6 version.
So for those who want to upgrade, it wouldn't be good to invert that I think…

alexku’s picture

FileSize
7.5 KB

Attached is a version of jdanthinne's port in comment #5 with fixed prev_next_views.

What was fixed:

  • prev_next_views_views_pre_execute implementation
  • modules hook_menu with corrected callback address (the fix also included a small change in prev_next_menu for tab to show up)
mgifford’s picture

Title: Port to D7 » Port Previous/Next API to D7

Great. So how does this compare with what's in Git for D6? Also, can we get a patch of this so it is easier to see the changes? Great that it's been run through Coder. Thanks @alexku & @jdanthinne

alexku’s picture

I have just run coders code review and still see some critical warnings. Will fix them in prev_next_views part and re-upload soon

mgifford’s picture

Thanks!

alexku’s picture

After fixing few coder module warnings I have created attached two patches. One is for initial d7 port from @jdanthinne and one is for prev_next_views

There are some warnings for prev_next module on using variables in db_query() query parameter.

Some of them (which use $search_criteria variable) are quite dangerous and can allow a user with 'access administration pages' permission to perform an SQL injection

Pls’s picture

Status: Needs review » Reviewed & tested by the community

Ok, so tested both patches against 6.x-1.x branch using vanilla D7 install.

Patch prev-next-drupal7-port-1231996-5.patch applies cleanly and prev_next navigation block works smoothly as expected.

Patch patch prev-next-views-drupal7-port-1231996-8.patch, which applies cleanly (though received warning about whitespace - it is right after function prev_next_menu() closing bracket) using latest views (and ctools) module with different node (nodes was generated by devel_generate) sort order's (Post date, Node ID, Image ALT) to see if everything is fine on different scenarios. And haven't seen any bugs.

Changing status to RTBC, though would be great if more testers could walk through same routine and test these patches. Thanks!

AndyF’s picture

I followed the procedure in #13 and the main module seems to be working fine, though I haven't thoroughly tested. I didn't try out the views module (actually not sure what it's supposed to do - just add a field?).

alexku’s picture

Views part saves view query result in a session and uses it for paging later. So you can use filters/arguments/ordering for paging

bhosmer’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Closed (fixed)