Make WordPress Core


Ignore:
Timestamp:
10/16/2012 08:05:40 PM (14 years ago)
Author:
ryan
Message:

Return WP_User objects when querying 'all' fields with WP_User_Query.
Allow passing stdClass or WP_User to the WP_User constructor.

fixes #22057

File:
1 edited

Legend:

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

    r22118 r22248  
    460460     * @access public
    461461     *
    462      * @param int|string $id User's ID
     462     * @param int|string|stdClass|WP_User $id User's ID, a WP_User object, or a user object from the DB.
    463463     * @param string $name Optional. User's username
    464464     * @param int $blog_id Optional Blog ID, defaults to current blog.
     
    476476                $prefix . 'usersettingstime' => $prefix . 'user-settings-time',
    477477            );
     478        }
     479
     480        if ( is_a( $id, 'WP_User' ) ) {
     481            $this->init( $id->data, $blog_id );
     482            return;
     483        } elseif ( is_object( $id ) ) {
     484            $this->init( $id, $blog_id );
     485            return;
    478486        }
    479487
Note: See TracChangeset for help on using the changeset viewer.