From 1566230aefb3aa471e0ef75a2af6919a791918f1 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 5 Aug 2008 13:40:55 +0000 Subject: Update: Added comment feed to Wordpress plugin Now with the addition of the comment feed, the Wordpress plugin is complete. (Well, it needs some tweaking, #17). Closes #6. --- .../plugin/wordpress/trunk/instadisc/instadisc.php | 30 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/update/plugin/wordpress/trunk/instadisc/instadisc.php b/update/plugin/wordpress/trunk/instadisc/instadisc.php index ba65516..2419e70 100644 --- a/update/plugin/wordpress/trunk/instadisc/instadisc.php +++ b/update/plugin/wordpress/trunk/instadisc/instadisc.php @@ -130,16 +130,16 @@ function id_settings_page() post_title; $author = $post->post_author; - $url = $post->guid; + $url = get_permalink($id); $verID = rand(1,65536); @@ -155,4 +155,28 @@ function sendPost($id) $client->send($msg); } +add_action('comment_post','sendComment'); + +function sendComment($id) +{ + $comment = get_comment($id); + $post = get_post($comment->comment_post_ID); + $title = $post->post_title; + $author = $comment->comment_author; + $url = get_permalink($comment->comment_post_ID) . "#comments"; + + $verID = rand(1,65536); + + $client = new xmlrpc_client(get_option('instaDisc_comment_centralServer')); + $msg = new xmlrpcmsg("InstaDisc.sendFromUpdate", array( new xmlrpcval(get_option('instaDisc_comment_centralServer_username'), 'string'), + new xmlrpcval(md5(get_option('instaDisc_comment_centralServer_username') . ':' . md5(get_option('instaDisc_comment_centralServer_password')) . ':' . $verID), 'string'), + new xmlrpcval($verID, 'int'), + new xmlrpcval(get_option('siteurl') . '/comments/', 'string'), + new xmlrpcval($title, 'string'), + new xmlrpcval($author, 'string'), + new xmlrpcval($url, 'string'), + new xmlrpcval(array(), 'array'))); + $client->send($msg); +} + ?> -- cgit 1.4.1