WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#16357 closed defect (bug) (fixed)

Bugs with pagination input

Reported by: garyc40 Owned by: markjaquith
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.1
Component: General Keywords: has-patch needs-testing
Focuses: 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 5 years ago.
fix redirection inconsistencies in edit-tags.php, users.php, network/users.php
garyc40.16356.2.diff (9.0 KB) - added by garyc40 5 years ago.
centralize redirection in set_pagination_args()
16356.patch (1.4 KB) - added by garyc40 5 years ago.
Sergey's patch
16357.fix.diff (1.3 KB) - added by garyc40 5 years ago.
fix redirect loop in users.php, network/users.php, edit-tags.php

Download all attachments as: .zip

Change History (16)

@garyc40
5 years ago

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

@garyc40
5 years ago

centralize redirection in set_pagination_args()

@garyc40
5 years ago

Sergey's patch

#1 @garyc40
5 years ago

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.

#2 @markjaquith
5 years ago

  • 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?

#3 @garyc40
5 years ago

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.

#4 @markjaquith
5 years ago

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

#6 @SergeyBiryukov
5 years ago

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

#7 @ryan
5 years ago

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

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

#8 @westi
5 years ago

  • 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 5 years ago by westi (previous) (diff)

@garyc40
5 years ago

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

#9 @garyc40
5 years ago

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

#10 @westi
5 years ago

  • 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

#11 @westi
5 years ago

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

#12 @markjaquith
5 years ago

westi — agreed! #16208

Note: See TracTickets for help on using tickets.