diff --git src/wp-admin/includes/user.php b/user.php
index fa868d9..08a3848 100755
old
|
new
|
function edit_user( $user_id = 0 ) { |
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
| 209 | * Additional checks for cross-referenced email and username among existing accounts. |
| 210 | * Prevent using existing email address as username and vice versa. |
| 211 | * Do not allow an existing email address to be used as a username of the new account. |
| 212 | * Do not allow an existing username to be used as the email address of the new account. |
| 213 | */ |
| 214 | |
| 215 | // Check if username is being used as the email address of another account. |
| 216 | if ( email_exists( $user->user_login ) ) { |
| 217 | $errors->add( 'email_exists_as_user_login', __( '<strong>ERROR</strong>: This username is invalid because it is already the email address of another account.' ) ); |
| 218 | } |
| 219 | |
| 220 | // Check if email address is being used as the username of another account. |
| 221 | |
| 222 | /** |
| 223 | * Adding new user. |
| 224 | */ |
| 225 | if ( ! $update ) { |
| 226 | if ( username_exists( $user->user_email ) ) { |
| 227 | $errors->add( 'username_exists', __( '<strong>ERROR</strong>: This email address cannot be used because it is already the username of another account.' ) ); |
| 228 | } |
| 229 | } else { |
| 230 | /** |
| 231 | * Updating existing user. |
| 232 | * |
| 233 | * $owner_id false | int. If no user is found $owner_id is false. Otherwise returns user ID. |
| 234 | */ |
| 235 | $owner_id = username_exists( $user->user_email ); |
| 236 | if ( $owner_id && ( $owner_id !== $user->ID ) ) { |
| 237 | $errors->add( 'username_exists', __( '<strong>ERROR</strong>: This email address cannot be used because it is already the username of another account.' ) ); |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | /** |
209 | 242 | * Fires before user profile update errors are returned. |
210 | 243 | * |
211 | 244 | * @since 2.8.0 |