Ticket #51379: 51379.4.diff
File 51379.4.diff, 2.2 KB (added by , 3 years ago) |
---|
-
src/wp-includes/user.php
1585 1585 * Conditional Tags} article in the Theme Developer Handbook. 1586 1586 * 1587 1587 * @since 2.0.0 1588 * @since 4.9.0 Introduced `username_exists` filter. 1588 1589 * 1589 * @param string $username Username.1590 * @param string $username The username to check for existence. 1590 1591 * @return int|false The user's ID on success, and false on failure. 1591 1592 */ 1592 1593 function username_exists( $username ) { … … 1598 1599 } 1599 1600 1600 1601 /** 1601 * Filters whether the given username exists or not.1602 * Filters whether the given username exists. 1602 1603 * 1603 1604 * @since 4.9.0 1604 1605 * 1605 * @param int|false $user_id The user's ID on success, and false on failure. 1606 * @param int|false $user_id The user's ID associated to the username, 1607 * or false if the username isn't associated to a user. 1606 1608 * @param string $username Username to check. 1607 1609 */ 1608 1610 return apply_filters( 'username_exists', $user_id, $username ); … … 1623 1625 function email_exists( $email ) { 1624 1626 $user = get_user_by( 'email', $email ); 1625 1627 if ( $user ) { 1626 return $user->ID; 1628 $user_id = $user->ID; 1629 } else { 1630 $user_id = false; 1627 1631 } 1628 return false; 1632 1633 /** 1634 * Filters whether the given email exists. 1635 * 1636 * @since 5.6.0 1637 * 1638 * @param int|false $user_id The user's ID on success, and false on failure. 1639 * @param string $email Email. 1640 */ 1641 return apply_filters( 'email_exists', $user_id, $email ); 1629 1642 } 1630 1643 1631 1644 /** … … 1642 1655 $valid = ( $sanitized == $username && ! empty( $sanitized ) ); 1643 1656 1644 1657 /** 1645 * Filters whether the provided username is valid or not.1658 * Filters whether the provided username is valid. 1646 1659 * 1647 1660 * @since 2.0.1 1648 1661 * … … 1833 1846 1834 1847 /* 1835 1848 * If there is no update, just check for `email_exists`. If there is an update, 1836 * check if current email and new email are the same, or not,and check `email_exists`1849 * check if current email and new email are the same, and check `email_exists` 1837 1850 * accordingly. 1838 1851 */ 1839 1852 if ( ( ! $update || ( ! empty( $old_user_data ) && 0 !== strcasecmp( $user_email, $old_user_data->user_email ) ) )