Ticket #41672: 41672.diff
File 41672.diff, 1.6 KB (added by , 6 years ago) |
---|
-
src/wp-includes/user.php
1474 1474 return new WP_Error( 'user_login_too_long', __( 'Username may not be longer than 60 characters.' ) ); 1475 1475 } 1476 1476 1477 $raw_user_email = empty( $userdata['user_email'] ) ? '' : $userdata['user_email']; 1478 1479 /** 1480 * Filters a user's email before the user is created or updated. 1481 * 1482 * @since 2.0.3 1483 * 1484 * @param string $raw_user_email The user's email. 1485 */ 1486 $user_email = apply_filters( 'pre_user_email', $raw_user_email ); 1487 1477 1488 if ( ! $update && username_exists( $user_login ) ) { 1478 return new WP_Error( 'existing_user_login', __( 'Sorry, that username already exists!' ) ); 1489 if ( email_exists( $user_email ) ) { 1490 return new WP_Error( 'existing_user_email', __( 'Sorry, that email address is already used!' ) ); 1491 } else { 1492 return new WP_Error( 'existing_user_login', __( 'Sorry, that username already exists!' ) ); 1493 } 1479 1494 } 1480 1495 1481 1496 /** … … 1529 1544 */ 1530 1545 $user_url = apply_filters( 'pre_user_url', $raw_user_url ); 1531 1546 1532 $raw_user_email = empty( $userdata['user_email'] ) ? '' : $userdata['user_email'];1533 1534 /**1535 * Filters a user's email before the user is created or updated.1536 *1537 * @since 2.0.31538 *1539 * @param string $raw_user_email The user's email.1540 */1541 $user_email = apply_filters( 'pre_user_email', $raw_user_email );1542 1543 1547 /* 1544 1548 * If there is no update, just check for `email_exists`. If there is an update, 1545 1549 * check if current email and new email are the same, or not, and check `email_exists`