Coding Standards: Use strict comparison in `wp-admin/includes/class-wp-users-list-table.php`.

This mirrors a similar check a few lines below and includes minor code layout fixes for better readability.

Follow-up to [9955], [13931], [14176], [15315], [45407], [50129].

See #54728.
Built from https://develop.svn.wordpress.org/trunk@52581


git-svn-id: http://core.svn.wordpress.org/trunk@52171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-01-15 20:49:06 +00:00
parent e05557e222
commit 0bc24dd81f
2 changed files with 19 additions and 5 deletions

View File

@ -447,7 +447,13 @@ class WP_Users_List_Table extends WP_List_Table {
// Check if the user for this row is editable. // Check if the user for this row is editable.
if ( current_user_can( 'list_users' ) ) { if ( current_user_can( 'list_users' ) ) {
// Set up the user editing link. // Set up the user editing link.
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) ); $edit_link = esc_url(
add_query_arg(
'wp_http_referer',
urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
get_edit_user_link( $user_object->ID )
)
);
if ( current_user_can( 'edit_user', $user_object->ID ) ) { if ( current_user_can( 'edit_user', $user_object->ID ) ) {
$edit = "<strong><a href=\"{$edit_link}\">{$user_object->user_login}</a>{$super_admin}</strong><br />"; $edit = "<strong><a href=\"{$edit_link}\">{$user_object->user_login}</a>{$super_admin}</strong><br />";
@ -456,10 +462,16 @@ class WP_Users_List_Table extends WP_List_Table {
$edit = "<strong>{$user_object->user_login}{$super_admin}</strong><br />"; $edit = "<strong>{$user_object->user_login}{$super_admin}</strong><br />";
} }
if ( ! is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) ) { if ( ! is_multisite()
&& get_current_user_id() !== $user_object->ID
&& current_user_can( 'delete_user', $user_object->ID )
) {
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . '</a>'; $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . '</a>';
} }
if ( is_multisite() && current_user_can( 'remove_user', $user_object->ID ) ) {
if ( is_multisite()
&& current_user_can( 'remove_user', $user_object->ID )
) {
$actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url . "action=remove&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . '</a>'; $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url . "action=remove&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . '</a>';
} }
@ -476,7 +488,9 @@ class WP_Users_List_Table extends WP_List_Table {
} }
// Add a link to send the user a reset password link by email. // Add a link to send the user a reset password link by email.
if ( get_current_user_id() !== $user_object->ID && current_user_can( 'edit_user', $user_object->ID ) ) { if ( get_current_user_id() !== $user_object->ID
&& current_user_can( 'edit_user', $user_object->ID )
) {
$actions['resetpassword'] = "<a class='resetpassword' href='" . wp_nonce_url( "users.php?action=resetpassword&amp;users=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Send password reset' ) . '</a>'; $actions['resetpassword'] = "<a class='resetpassword' href='" . wp_nonce_url( "users.php?action=resetpassword&amp;users=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Send password reset' ) . '</a>';
} }

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.0-alpha-52580'; $wp_version = '6.0-alpha-52581';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.