Make WordPress Core

Ticket #51379: 51379.3.diff

File 51379.3.diff, 1.5 KB (added by garrett-eclipse, 3 years ago)

Further phpdoc enhancement bringing more parity between the email_exists and username_exists functions and filters

  • src/wp-includes/user.php

     
    15851585 * Conditional Tags} article in the Theme Developer Handbook.
    15861586 *
    15871587 * @since 2.0.0
     1588 * @since 4.9.0 Introduced `username_exists` filter.
    15881589 *
    1589  * @param string $username Username.
     1590 * @param string $username The username to check for existence.
    15901591 * @return int|false The user's ID on success, and false on failure.
    15911592 */
    15921593function username_exists( $username ) {
     
    15981599        }
    15991600
    16001601        /**
    1601          * Filters whether the given username exists or not.
     1602         * Filters whether the given username exists.
    16021603         *
    16031604         * @since 4.9.0
    16041605         *
    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.
    16061608         * @param string    $username Username to check.
    16071609         */
    16081610        return apply_filters( 'username_exists', $user_id, $username );
     
    16231625function email_exists( $email ) {
    16241626        $user = get_user_by( 'email', $email );
    16251627        if ( $user ) {
    1626                 return $user->ID;
     1628                $user_id = $user->ID;
     1629        } else {
     1630                $user_id = false;
    16271631        }
    1628         return false;
     1632
     1633        /**
     1634         * Filters whether the given email exists or not.
     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 );
    16291642}
    16301643
    16311644/**