Users: Make sure bulk actions are only executed with the Apply button, not Change.

The Change button is supposed to perform the “Change role to...” action only, but could unintentionally be used for other bulk actions if the role was not selected.

This commit removes an extra check and ensures the correct error message is displayed in that case:

 Sorry, you are not allowed to give users that role.

Follow-up to [6990], [8691], [9028], [15576], [15642], [34636], [49944].

Props haritpanchal, costdev, ankit-k-gupta, SergeyBiryukov.
Fixes #57952.

git-svn-id: https://develop.svn.wordpress.org/trunk@55864 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2023-05-28 11:44:24 +00:00
parent 3d0b0bb884
commit 7a89d0a265

View File

@ -353,7 +353,7 @@ class WP_Users_List_Table extends WP_List_Table {
* @return string The bulk action required.
*/
public function current_action() {
if ( isset( $_REQUEST['changeit'] ) && ! empty( $_REQUEST['new_role'] ) ) {
if ( isset( $_REQUEST['changeit'] ) ) {
return 'promote';
}