Domain Mapping breaks some xmlrpc functions
-
I try to use Live Writer on a multisite wordpress blog which is mapped to a primary domain. Live Writer cannot add the blog.
I’ve found where is the issue in the code but I don’t understand why.
Here’re my blog details for the purpose of the explanation:
Network is “at.cameuh.net”
Site is “easytrading.at.cameuh.net”
Primary Mapping for the blog is “easytrading.eu”When setting up my easytrading.eu blog in Windows Live Writer, this XMLRPC request returns an empty array response:
* LW request:
Host: <strong>easytrading.eu</strong> <methodCall> <methodName><strong>blogger.getUsersBlogs</strong></methodName><params> <param><value><string>0123456789ABCDEF</string></value></param> <param><value><string>cameuh</string></value></param> <param><value><string>shutitup</string></value></param> </params></methodCall>* WP executes this PHP code to SELF-QUERY using XMLRPC to convert blogger API to wp API:
wp-includes/class-wp-xmlrpc-server.phpfunction _multisite_getUsersBlogs($args) { global $current_blog; <strong>$domain = $current_blog->domain;</strong> $path = $current_blog->path . 'xmlrpc.php'; $protocol = is_ssl() ? 'https' : 'http'; $rpc = new <strong>IXR_Client("$protocol://{$domain}{$path}");</strong> $rpc->query('<strong>wp.getUsersBlogs</strong>', $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); } <strong>return array();</strong> } }* Here’s this request received by Apache:
Host: easytrading.at.cameuh.net
<?xml version=”1.0″?>
<methodCall><methodName>wp.getUsersBlogs</methodName>
<params><param><value><string>cameuh</string></value></param>
<param><value><string>shutitup</string></value></param>
</params></methodCall>* This call returns results using easytrading.at.cameuh.net!
* The problem here lies where WP Self Query uses $current_blog->domain to setup the URL.
* Could you fix the plugin so the proper HOST (easytrading.eu but not easytrading.at.cameuh.net) is used when WP tries to self query?
* I’ve workarounded this issue by statically setting $domain=’easytrading.eu’ — that works while only this blog is remotely used.
The topic ‘Domain Mapping breaks some xmlrpc functions’ is closed to new replies.