Make WordPress Core

Opened 9 years ago

Last modified 6 years ago

#34799 new enhancement

Tell admin-post.php to check for $_REQUEST['action2'] ?

Reported by: jlambe's profile jlambe Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Administration Keywords:
Focuses: administration Cc:

Description

In plugin development, we can handle POST requests through the admin-post.php file. This file is looking after an input with a name of action so we can register a custom hook to handle the POST request.

After looking at the WP_List_Table, the bulk "select" top tag has a name attribute of action. So for custom development, the form where the list table fit can easily point to admin-post.php and we can handle the bulk POST request through a custom hook and it works.

But here is the issue, if users use the "select" bottom tag for their bulk action, it won't work because the bottom select tag has a name attribute of action2. So if a POST request to admin-post.php, we can no longer listen to a custom hook to manipulate the request and its data.

So I'm asking if it will be ok to update the admin-post.php file to check after a $_REQUEST['action2'] as well?

Change History (4)

#1 follow-up: @swissspidy
9 years ago

I think this is better fixed by syncing those two dropdowns, see #16185.

#2 in reply to: ↑ 1 ; follow-up: @jlambe
9 years ago

Replying to swissspidy:

I think this is better fixed by syncing those two dropdowns, see #16185.

I haven't tested the #16185 patch but it should fix it as it makes sure the action select tag has a value different than -1. I know that the mentioned patch needs JS for this to work and I can't think of WordPress working without JS but what if we make sure the admin-post.php is still looking after the action2 value as well as a fallback?

#3 in reply to: ↑ 2 ; follow-up: @swissspidy
9 years ago

Replying to jlambe:

Replying to swissspidy:

I think this is better fixed by syncing those two dropdowns, see #16185.

I haven't tested the #16185 patch but it should fix it as it makes sure the action select tag has a value different than -1. I know that the mentioned patch needs JS for this to work and I can't think of WordPress working without JS but what if we make sure the admin-post.php is still looking after the action2 value as well as a fallback?

Or we could just set the second element's name to action as well and apply hide-if-no-js to it.

#4 in reply to: ↑ 3 @afercia
9 years ago

Replying to swissspidy:

Or we could just set the second element's name to action as well

Wondering why there isn't a check on which of the two "Apply" buttons gets activated, maybe for historical reasons (IE6 issues with multiple submit buttons)? This was also suggested in a (closed) related ticket comment. Maybe I'm missing something but I'd do this on the server side first and then (maybe) sync via JavaScript. Thoughts?

Note: See TracTickets for help on using tickets.