Skip to content

Commit

Permalink
Coding Standards: Use strict comparison in wp-admin/user-edit.php.
Browse files Browse the repository at this point in the history
Follow-up to [2872], [13941], [12722], [14043], [14802], [23364], [42688].

Props azouamauriac.
See #54728.

git-svn-id: https://develop.svn.wordpress.org/trunk@52687 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Feb 7, 2022
1 parent f9f66ac commit 97830c4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/wp-admin/user-edit.php
Expand Up @@ -13,8 +13,9 @@

$user_id = (int) $user_id;
$current_user = wp_get_current_user();

if ( ! defined( 'IS_PROFILE_PAGE' ) ) {
define( 'IS_PROFILE_PAGE', ( $user_id == $current_user->ID ) );
define( 'IS_PROFILE_PAGE', ( $user_id === $current_user->ID ) );
}

if ( ! $user_id && IS_PROFILE_PAGE ) {
Expand Down Expand Up @@ -93,7 +94,7 @@
*/
if ( is_multisite()
&& ! current_user_can( 'manage_network_users' )
&& $user_id != $current_user->ID
&& $user_id !== $current_user->ID
&& ! apply_filters( 'enable_edit_any_user_configuration', true )
) {
wp_die( __( 'Sorry, you are not allowed to edit this user.' ) );
Expand Down Expand Up @@ -166,7 +167,10 @@
$errors = edit_user( $user_id );

// Grant or revoke super admin status if requested.
if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && ! isset( $super_admins ) && empty( $_POST['super_admin'] ) == is_super_admin( $user_id ) ) {
if ( is_multisite() && is_network_admin()
&& ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' )
&& ! isset( $super_admins ) && empty( $_POST['super_admin'] ) === is_super_admin( $user_id )
) {
empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id );
}

Expand Down Expand Up @@ -508,7 +512,7 @@
<th><label for="email"><?php _e( 'Email' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
<td><input type="email" name="email" id="email" aria-describedby="email-description" value="<?php echo esc_attr( $profileuser->user_email ); ?>" class="regular-text ltr" />
<?php
if ( $profileuser->ID == $current_user->ID ) :
if ( $profileuser->ID === $current_user->ID ) :
?>
<p class="description" id="email-description">
<?php _e( 'If you change this, we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?>
Expand All @@ -517,7 +521,7 @@
endif;

$new_email = get_user_meta( $current_user->ID, '_new_email', true );
if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) :
if ( $new_email && $new_email['newemail'] !== $current_user->user_email && $profileuser->ID === $current_user->ID ) :
?>
<div class="updated inline">
<p>
Expand Down Expand Up @@ -862,7 +866,7 @@
$output = '';
foreach ( $profileuser->caps as $cap => $value ) {
if ( ! $wp_roles->is_role( $cap ) ) {
if ( '' != $output ) {
if ( '' !== $output ) {
$output .= ', ';
}

Expand Down

0 comments on commit 97830c4

Please sign in to comment.