Ticket #17541: class-wp-xmlrpc-server patch for multisite.patch
| File class-wp-xmlrpc-server patch for multisite.patch, 1.8 KB (added by , 15 years ago) |
|---|
-
class-wp-xmlrpc-server.php
1754 1754 * @access protected 1755 1755 */ 1756 1756 function _multisite_getUsersBlogs($args) { 1757 global $current_blog; 1758 $domain = $current_blog->domain; 1759 $path = $current_blog->path . 'xmlrpc.php'; 1760 $protocol = is_ssl() ? 'https' : 'http'; 1757 global $current_site; 1758 $this->escape( $args ); 1761 1759 1762 $rpc = new IXR_Client("$protocol://{$domain}{$path}"); 1763 $rpc->query('wp.getUsersBlogs', $args[1], $args[2]); 1764 $blogs = $rpc->getResponse(); 1760 $username = $args[1]; 1761 $password = $args[2]; 1765 1762 1766 if ( isset($blogs['faultCode']) )1767 return new IXR_Error($blogs['faultCode'], $blogs['faultString']);1763 if ( !$user = $this->login($username, $password) ) 1764 return $this->error; 1768 1765 1769 if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) { 1770 return $blogs; 1771 } else { 1772 foreach ( (array) $blogs as $blog ) { 1773 if ( strpos($blog['url'], $_SERVER['HTTP_HOST']) ) 1774 return array($blog); 1775 } 1776 return array(); 1766 do_action( 'xmlrpc_call', 'blogger.getUsersBlogs' ); 1767 1768 $blogs = (array) get_blogs_of_user( $user->ID ); 1769 $struct = array( ); 1770 1771 foreach ( $blogs as $blog ) { 1772 // Don't include blogs that aren't hosted at this site 1773 if ( $blog->site_id != $current_site->id ) 1774 continue; 1775 1776 $blog_id = $blog->userblog_id; 1777 switch_to_blog($blog_id); 1778 $is_admin = current_user_can('manage_options'); 1779 1780 $struct[] = array( 1781 'isAdmin' => $is_admin, 1782 'url' => get_option( 'home' ) . '/', 1783 'blogid' => (string) $blog_id, 1784 'blogName' => get_option( 'blogname' ), 1785 'xmlrpc' => site_url( 'xmlrpc.php' ) 1786 ); 1787 1788 restore_current_blog( ); 1777 1789 } 1790 1791 return $struct; 1778 1792 } 1779 1793 1780 1794 /**