Opened 13 years ago
Closed 13 years ago
#17285 closed defect (bug) (fixed)
Pagination of plugins search results does not work
Reported by: | pavelevap | Owned by: | dd32 |
---|---|---|---|
Milestone: | 3.2 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Administration | Keywords: | has-patch |
Focuses: | Cc: |
Description
I tested several plugins and noticed that pagination of plugins search results does not work. Simply, search string is not passed to pagination links.
- Go to Plugins menu.
- Set small (testing) number in Screen tab for plugin pagination.
- Enter for example "Menu" into searchbox (or any other word to have chance to find some installed plugins).
- There are 11 items found, 3 pages available for me, I can see first 5 related plugins, everything looks well.
- But when you click on "Next page" icon to see other search results, you are redirected to second page, but of all plugins. Search string is not passed to pagination links...
Attachments (1)
Change History (14)
#1
@
13 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to 3.2
- Version changed from 3.2 to 3.1
#3
@
13 years ago
Seems like the plugins page is the last screen which uses method="post" instead of method="get".
#4
@
13 years ago
- Cc dbernar1 added
I was just saying the same thing on the wordpress-dev channel. Switching the form to a get form fixes the issue.
The "problem" there is that the URL generated by the get form looks like this:
/wp-admin/plugins.php?s=menu&plugin_status=search&paged=1&_wpnonce=14cb602e07&_wp_http_referer=%2Fwordpress-trunk%2Fwp-admin%2Fplugins.php%3Fs%3Dmenu%26plugin_status%3Dall%26paged%3D1%26_wpnonce%3D14cb602e07%26_wp_http_referer%3D%252Fwordpress-trunk%252Fwp-admin%252Fplugins.php%26action%3D-1%26action2%3D-1&action=-1&paged=1&action2=-1
I don't know for sure that this is a problem, but it seems like it might have some URL params that it does not need.
#6
@
13 years ago
Also bulk stuff will not work any longer, because they rely on $_POST.
For posts/etc it's fine as the checkboxes are ID's, for Plugins the checkbox values are going to be Plugin names, so on average lets say 20char long.. That'll easily make a looong url when you perform bulk actions on many plugins..
#7
@
13 years ago
We can leave the action as POST, but make the search check $_REQUEST. Then, we could just pass 's' into the pagination URL.
#8
@
13 years ago
- Keywords has-patch added; needs-patch removed
- Owner set to dd32
- Status changed from new to accepted
Since the list tables have no filters of any kind on the pagination, it's a bit hard to do this any other way.
I seem to recall something bad about modifying $_SERVER['REQUEST_URI']
with add_query_arg(), but I can't remember what it was; So this is my patch: (Any comments?)
-
wp-admin/includes/class-wp-plugins-list-table.php
21 21 if ( $status != $default_status && 'search' != $status ) 22 22 update_user_meta( get_current_user_id(), 'plugins_last_view', $status ); 23 23 24 25 if ( isset($_REQUEST['s']) ) 26 $_SERVER['REQUEST_URI'] = add_query_arg('s', stripslashes($_REQUEST['s']) ); 27 24 28 $page = $this->get_pagenum(); 25 29 26 30 parent::__construct( array(
#9
@
13 years ago
It's cool that you can post diffs inline, but that makes it a chore to apply it to a local install.
Confirmed.