_prepare_user example

if ( ! current_user_can( 'edit_user', $user_id ) ) {
            return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this user.' ) );
        }

        $user_data = get_userdata( $user_id );

        if ( ! $user_data ) {
            return new IXR_Error( 404, __( 'Invalid user ID.' ) );
        }

        return $this->_prepare_user( $user_data$fields );
    }

    /** * Retrieves users. * * The optional $filter parameter modifies the query used to retrieve users. * Accepted keys are 'number' (default: 50), 'offset' (default: 0), 'role', * 'who', 'orderby', and 'order'. * * The optional $fields parameter specifies what fields will be included * in the response array. * * @uses get_users() * @see wp_getUser() for more on $fields and return values * * @param array $args { * Method arguments. Note: arguments must be ordered as documented. * * @type int $0 Blog ID (unused). * @type string $1 Username. * @type string $2 Password. * @type array $3 Optional. Arguments for the user query. * @type array $4 Optional. Fields to return. * } * @return array|IXR_Error users data */
Home | Imprint | This part of the site doesn't use cookies.