I would like to use Wordpress' XML-RPC to retrieve all comments associated with a particular author email, but there doesn't seem to be such a filter in the wp.getComments XML-RPC API? I wanted to check if there was a good way to do this before I write a plugin for it :)
Well, in the end I did write a plugin for it. It required that use Wordpress' database functions directly. Here is the extracted code for anyone else who needs to do this. Enjoy :)
function catsynth_getCommentsByEmail( $args ) {
global $wp_xmlrpc_server;
global $wpdb;
$wp_xmlrpc_server->escape( $args );
$blog_id = $args[0];
$username = $args[1];
$password = $args[2];
$params = $args[3];
if ( ! $user = $wp_xmlrpc_server->login( $username, $password ) )
return $wp_xmlrpc_server->error;
$email = $params["email"];
$query = "SELECT * FROM `wp_comments` WHERE `comment_author_email` = '".$email."' AND `comment_approved`=1 ORDER BY comment_date DESC LIMIT 0,30";
$comments = $wpdb->get_results($query);
foreach( $comments as $comment ) {
$comment->post_id = $comment->comment_post_ID;
$comment->post_title = get_the_title($comment->comment_post_ID);
}
return $comments;
}