wp_xmlrpc_server::_multisite_getUsersBlogs() WordPress Method

The wp_xmlrpc_server::_multisite_getUsersBlogs() method is used to get a list of blogs for a user on a multisite installation. This is useful for displaying a list of blogs a user is a member of, or for managing user permissions across a multisite network.

wp_xmlrpc_server::_multisite_getUsersBlogs( array $args ) #

Private function for retrieving a users blogs for multisite setups


Parameters

$args

(array)(Required)Method arguments. Note: arguments must be ordered as documented.

  • 'username'
    (string) Username.
  • 'password'
    (string) Password.


Top ↑

Return

(array|IXR_Error)


Top ↑

Source

File: wp-includes/class-wp-xmlrpc-server.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();
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More