Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#16357 closed defect (bug) (fixed)

Bugs with pagination input

Reported by: garyc40 Owned by: markjaquith
Priority: normal Milestone: 3.1
Component: General Version: 3.1
Severity: normal Keywords: has-patch needs-testing
Cc:

Description

(moved from #16356)

There are a few bugs with pagination that I found

  • users.php don't redirect when $pagenum > $total_pages
  • Go to edit-tags.php, navigate to the 3rd page, for example. Then enter 2 in the pagination input box and press enter. You'll be in page number 3.
  • Go to network/users.php , enter a page number in the pagination input box and press enter. It simply redirects to page 1.
  • WP_Users_List_Table and WP_MS_Users_List_Table doesn't set the proper pagination args when $pagenum > $total_pages . This is because total user count is not executed when no results are returned from the query. See the change I made in wp-includes/user.php.

Should all the redirection when $pagenum > $total_pages be centralized in WP_List_Table? We can put that logic inside WP_List_Table->set_pagination_args().

Attachments (4)

garyc40.16356.diff (4.1 KB) - added by garyc40 2 years ago.
fix redirection inconsistencies in edit-tags.php, users.php, network/users.php
garyc40.16356.2.diff (9.0 KB) - added by garyc40 2 years ago.
centralize redirection in set_pagination_args()
16356.patch (1.4 KB) - added by garyc40 2 years ago.
Sergey's patch
16357.fix.diff (1.3 KB) - added by garyc40 2 years ago.
fix redirect loop in users.php, network/users.php, edit-tags.php

Download all attachments as: .zip

Change History (16)

garyc402 years ago

fix redirection inconsistencies in edit-tags.php, users.php, network/users.php

garyc402 years ago

centralize redirection in set_pagination_args()

garyc402 years ago

Sergey's patch

Related to #16208.

Since #16208 is marked as 3.2-early, and the centralization of redirection is kind of too much change for 3.1 especially when we're already at RC3, I think we should only focus on the bugs outlined in the description (addressed in garyc40.16356.diff) .

I attached garyc40.16356.2.diff here anyways, just in case someone wants to test it.

  • Milestone changed from Awaiting Review to 3.1
  • Owner set to markjaquith
  • Status changed from new to accepted

Is Sergey's patch incorporated into your patch? i.e. are you just including it for historical purposes?

For historical purposes. My patch is posted after his, and has similar changes in wp-admin/users.php

The approach for counting users when $paged > $total_pages is different, and I tried to fix pagination issues on other pages as well.

Sorry for the confusion.

This looks great to me. Fixes the issues. Can I get a few other people to do a sanity check?

For people reviewing: the patch under consideration is: http://core.trac.wordpress.org/attachment/ticket/16357/garyc40.16356.diff

TortoiseSVN didn't like the patch for some reason. Works great after manual editing. Tested all the cases outlined in the description.

comment:7   ryan2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [17361]) Pagination fixes. Props garyc40. fixes #16357

  • Resolution fixed deleted
  • Status changed from closed to reopened

This breaks Network > Users when no search results - we end up with a redirect loop as $pagenum} is 1 and {{{$total_pages}} is 0

Something like this fixes it:

if ( $pagenum > $total_pages && 0 != $total_pages ) {
	wp_redirect( add_query_arg( 'paged', $total_pages ) );
	exit;
}
Last edited 2 years ago by westi (previous) (diff)

garyc402 years ago

fix redirect loop in users.php, network/users.php, edit-tags.php

There are two more instances in Site Admin > Users and Categories / Tags . Above patch fixes this.

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [17366]) Don't redirect continually on empty search results pages. Fixes #16357 props garyc40

All these redirects seem to work in a lame way - hopefully we can fix them with some centralisation of the code in 3.2

westi — agreed! #16208

Note: See TracTickets for help on using tickets.