WordPress at a glance
function is not described

wp_xmlrpc_server::_multisite_getUsersBlogs() protected WP 3.0.0

Private function for retrieving a users blogs for multisite setups

{} It's a method of the class: wp_xmlrpc_server{}

No Hooks.

Return

Array/IXR_Error.

Usage

// protected - for code of main (parent) or child class
$result = $this->_multisite_getUsersBlogs( $args );
$args(array) (required)

Method arguments. Note: arguments must be ordered as documented.

  • username(string)
    Username.

  • password(string)
    Password.

Changelog

Since 3.0.0 Introduced.

Code of wp_xmlrpc_server::_multisite_getUsersBlogs() WP 5.5.3

<?php
protected function _multisite_getUsersBlogs( $args ) {
	$current_blog = get_site();

	$domain = $current_blog->domain;
	$path   = $current_blog->path . 'xmlrpc.php';

	$rpc = new IXR_Client( set_url_scheme( "http://{$domain}{$path}" ) );
	$rpc->query( 'wp.getUsersBlogs', $args[1], $args[2] );
	$blogs = $rpc->getResponse();

	if ( isset( $blogs['faultCode'] ) ) {
		return new IXR_Error( $blogs['faultCode'], $blogs['faultString'] );
	}

	if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) {
		return $blogs;
	} else {
		foreach ( (array) $blogs as $blog ) {
			if ( strpos( $blog['url'], $_SERVER['HTTP_HOST'] ) ) {
				return array( $blog );
			}
		}
		return array();
	}
}