<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks again,<div><br></div><div>Can anyone confirm if the blog_id parameter should work in the wp.getComments call? This is what I'm doing to test it:</div><div><br></div><div>I've tried passing the blog ID as both a string and an integer. Wordpress MU version is 2.9.2</div><div><br></div><div>I always get the comments from the default blog.</div><div><br></div><div><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial"><?php</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">error_reporting(E_ALL);</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">$method= 'wp.getComments';</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">$username = 'admin';</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">$password = 'disney75';</font></span></p><br><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">$blog_id = 2;</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">$params = array($blog_id, $username, $password, array('status'=>'approve'));</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">$service_url = '<a href="http://wpmu.localhost/xmlrpc.php';">http://wpmu.localhost/xmlrpc.php';</a></font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">//Using the XML-RPC extension to format the XML package</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">$request = xmlrpc_encode_request($method, $params);</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">//var_dump($request);</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">$req = curl_init($service_url);</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">// Using the cURL extension to send it off, first creating a custom header block</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">$headers = array();</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">array_push($headers,"Content-Type: text/xml");</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">array_push($headers,"Content-Length: ".strlen($request));</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">array_push($headers,"\r\n");</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">//URL to post to</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">curl_setopt($req, CURLOPT_URL, $service_url);</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">//Setting options for a secure SSL based xmlrpc server</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">curl_setopt($req, CURLOPT_SSL_VERIFYPEER, false);</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">curl_setopt($req, CURLOPT_SSL_VERIFYHOST, 2);</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">curl_setopt( $req, CURLOPT_CUSTOMREQUEST, 'POST' );</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">curl_setopt($req, CURLOPT_RETURNTRANSFER, 1 );</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">curl_setopt($req, CURLOPT_HTTPHEADER, $headers );</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">curl_setopt( $req, CURLOPT_POSTFIELDS, $request );</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">//Finally run</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">$response = curl_exec($req);</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">//Close the cURL connection</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">curl_close($req);</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">//Decoding the response to be displayed</font></span></p><p dir="LTR"><span lang="en-gb"><font size="2" face="Arial">var_dump($response);</font></span></p></div><div><br></div><div><br><div><div>On 14 May 2010, at 15:51, <a href="mailto:eric@eamann.com">eric@eamann.com</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">You can define your own XML-RPC methods and the functions that handle those method calls. That's what I meant by the handler function. For example, I use XML-RPC in all my plug-ins to report back installation progress and errors - each plug-in makes an XML-RPC call to a custom handler (method) on my server.</div><p style="margin: 0px;"> </p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Basically, you can define your own version of wp.getComments (maybe wpCustom.getComments) that focuses on MU blogs in whatever way you choose (identifying one blog by blog ID or getting information universally).<span></span></div><div> <br class="webkit-block-placeholder"></div>
<div style="margin: 5px 0px 5px 0px; font-family: monospace;">
On May 14, 2010 at 2:42 PM Luke Mackenzie <<a href="mailto:luke@lukem.co.uk">luke@lukem.co.uk</a>> wrote:<br>
<br>
> Could you expand on what you mean by the handler function?<br>
><br>
> I'm trying this call as an example:<br>
><br>
> <a href="http://codex.wordpress.org/XML-RPC/wp.getComments">http://codex.wordpress.org/XML-RPC/wp.getComments</a><br>
><br>
> Altering the blog_id has no effect on the comments returned. I have read elsewhere that the blog_id parameter is ignored. Is that still the case?<br>
><br>
> An alternative would be to use different endpoints per blog as I believe these are separate in MU?<br>
><br>
><br>
> Thanks again,<br>
><br>
> Luke.<br>
><br>
><br>
> On 14 May 2010, at 14:26, Eric Mann wrote:<br>
><br>
> > Luke,<br>
> ><br>
> > I've worked with WordPress' XMLRPC system before (using a WP-Hive<br>
> > installation with multiple separate blogs similar to a WPMU set-up). The<br>
> > new approach you're using is definitely simpler and easier to implement (I<br>
> > tried the 5ubliminal one as well the first time).<br>
> ><br>
> > Whether or not you can distinguish between separate blogs in a MU<br>
> > installation depends entirely on how you build your handler function. You<br>
> > can build it to distinguish the separate blogs, to only function on specific<br>
> > blogs, or to treat the entire system as a single WordPress site. It's all<br>
> > up to you.<br>
> ><br>
> > Yes, you can retrieve and post to custom fields.<br>
> ><br>
> > Absolutely writing a plug-in is the way to go. The only other options are<br>
> > to change core files (BAD idea) or to build it into your theme, in which<br>
> > case it could ONLY be used on MU sites using that theme. Build it as a<br>
> > site-wide MU plug-in that can be controlled on a site-by-site basis by the<br>
> > global admin.<br>
> ><br>
> > ~Eric<br>
> ><br>
> > Eric Mann<br>
> > <a href="http://www.eamann.com">www.eamann.com</a><br>
> ><br>
> ><br>
> > -----Original Message-----<br>
> > From: <a href="mailto:wp-xmlrpc-bounces@lists.automattic.com">wp-xmlrpc-bounces@lists.automattic.com</a><br>
> > [mailto:wp-xmlrpc-bounces@lists.automattic.com] On Behalf Of Luke Mackenzie<br>
> > Sent: Friday, May 14, 2010 5:52 AM<br>
> > To: <a href="mailto:wp-xmlrpc@lists.automattic.com">wp-xmlrpc@lists.automattic.com</a><br>
> > Subject: [wp-xmlrpc] XMLRPC for Wordpress Mu<br>
> ><br>
> > Hi,<br>
> ><br>
> > I have been tasked with creating an API for retrieving and adding content to<br>
> > Wordpress from a flash application and legacy CMS (non-PHP). My plan is to<br>
> > utilise the existing default xmlrpc endpoint and add any additional<br>
> > functionality by creating a plugin which hooks into xmlrpc_methods.<br>
> ><br>
> > A previous attempt had been made by another developer based on the following<br>
> > code:<br>
> ><br>
> > <a href="http://blog.5ubliminal.com/posts/remote-control-wordpress-blog-xmlrpc-api/">http://blog.5ubliminal.com/posts/remote-control-wordpress-blog-xmlrpc-api/</a><br>
> ><br>
> > This code looks unwieldy and poorly documented to me and my preference would<br>
> > be to use this approach:<br>
> ><br>
> > <a href="http://kovshenin.com/archives/custom-xml-rpc-methods-in-wordpress/">http://kovshenin.com/archives/custom-xml-rpc-methods-in-wordpress/</a><br>
> ><br>
> > I would be grateful if anyone with experience in this area could confirm<br>
> > that:<br>
> ><br>
> > - I will be able to distinguish between separate blogs in an MU installation<br>
> > when both retrieving and posting data via XMLRPC<br>
> > - I will be able to retrieve and post to custom fields<br>
> > - writing a plugin is the way to go.<br>
> ><br>
> > We do not have the option of using Wordpress 3 as it is still in Beta and we<br>
> > are under time pressure.<br>
> ><br>
> > I would greatly appreciate appreciate any input / advice.<br>
> ><br>
> > Many thanks,<br>
> ><br>
> > Luke.<br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > wp-xmlrpc mailing list<br>
> > <a href="mailto:wp-xmlrpc@lists.automattic.com">wp-xmlrpc@lists.automattic.com</a><br>
> > <a href="http://lists.automattic.com/mailman/listinfo/wp-xmlrpc">http://lists.automattic.com/mailman/listinfo/wp-xmlrpc</a><br>
> ><br>
> > _______________________________________________<br>
> > wp-xmlrpc mailing list<br>
> > <a href="mailto:wp-xmlrpc@lists.automattic.com">wp-xmlrpc@lists.automattic.com</a><br>
> > <a href="http://lists.automattic.com/mailman/listinfo/wp-xmlrpc">http://lists.automattic.com/mailman/listinfo/wp-xmlrpc</a><br>
><br>
> _______________________________________________<br>
> wp-xmlrpc mailing list<br>
> <a href="mailto:wp-xmlrpc@lists.automattic.com">wp-xmlrpc@lists.automattic.com</a><br>
> <a href="http://lists.automattic.com/mailman/listinfo/wp-xmlrpc">http://lists.automattic.com/mailman/listinfo/wp-xmlrpc</a><br>
</div>
</div>
_______________________________________________<br>wp-xmlrpc mailing list<br><a href="mailto:wp-xmlrpc@lists.automattic.com">wp-xmlrpc@lists.automattic.com</a><br>http://lists.automattic.com/mailman/listinfo/wp-xmlrpc<br></blockquote></div><br></div></body></html>