WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/06/2012 07:18:45 PM (10 years ago)
Author:
ryan
Message:

Introduce WP_User::exists(). see #20372

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/capabilities.php

    r19712 r20378  
    597597
    598598        $this->data->$key = $value;
     599    }
     600
     601    /**
     602     * Determine whether the user exists in the database.
     603     *
     604     * @since 3.4.0
     605     * @access public
     606     *
     607     * @return bool True if user exists in the database, false if not.
     608     */
     609    function exists() {
     610        return ! empty( $this->ID );
    599611    }
    600612
     
    12601272        $user = new WP_User( $user );
    12611273
    1262     if ( ! $user || ! $user->ID )
     1274    if ( ! $user || ! $user->exists() )
    12631275        return false;
    12641276
     
    13571369        $user = wp_get_current_user();
    13581370
    1359     if ( empty( $user->ID ) )
     1371    if ( ! $user->exists() )
    13601372        return false;
    13611373
Note: See TracChangeset for help on using the changeset viewer.