Changeset 49148
- Timestamp:
- 10/14/2020 07:02:22 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/user.php
r49139 r49148 1587 1587 * @since 2.0.0 1588 1588 * 1589 * @param string $username Username.1590 * @return int|false The user 's ID on success, andfalse on failure.1589 * @param string $username The username to check for existence. 1590 * @return int|false The user ID on success, false on failure. 1591 1591 */ 1592 1592 function username_exists( $username ) { … … 1599 1599 1600 1600 /** 1601 * Filters whether the given username exists or not.1601 * Filters whether the given username exists. 1602 1602 * 1603 1603 * @since 4.9.0 1604 1604 * 1605 * @param int|false $user_id The user's ID on success, and false on failure. 1605 * @param int|false $user_id The user ID associated with the username, 1606 * or false if the username does not exist. 1606 1607 * @param string $username Username to check. 1607 1608 */ … … 1619 1620 * 1620 1621 * @param string $email Email. 1621 * @return int|false The user 's ID on success, andfalse on failure.1622 * @return int|false The user ID on success, false on failure. 1622 1623 */ 1623 1624 function email_exists( $email ) { 1624 1625 $user = get_user_by( 'email', $email ); 1625 1626 if ( $user ) { 1626 return $user->ID; 1627 } 1628 return false; 1627 $user_id = $user->ID; 1628 } else { 1629 $user_id = false; 1630 } 1631 1632 /** 1633 * Filters whether the given email exists. 1634 * 1635 * @since 5.6.0 1636 * 1637 * @param int|false $user_id The user ID associated with the email, 1638 * or false if the email does not exist. 1639 * @param string $email Email. 1640 */ 1641 return apply_filters( 'email_exists', $user_id, $email ); 1629 1642 } 1630 1643 … … 1633 1646 * 1634 1647 * @since 2.0.1 1635 * @since 4.4.0 Empty sanitized usernames are now considered invalid 1648 * @since 4.4.0 Empty sanitized usernames are now considered invalid. 1636 1649 * 1637 1650 * @param string $username Username. 1638 * @return bool Whether username given is valid 1651 * @return bool Whether username given is valid. 1639 1652 */ 1640 1653 function validate_username( $username ) { … … 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 … … 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 */
Note: See TracChangeset
for help on using the changeset viewer.