I always hunger for comment. :)

In my wordpress, -to protect spam comment- I must approve every comment via web browser. but, because of my blog is not crowded, I was on a fool’s errand often.

I don’t want be disappointed via web browser. so…

google it!

I found WordPress Comment Moderation Notifier on “How-To Geek” that describe how to get count of approve-ready comment via XML-RPC.

at very last of above article, you can download  WordPressNotify_0.1.zip. This archive contain two programs;

  1. wordpress plugin: geek-wp-notifier.php
  2. desktop client

copy the plugin to “wp-contents/plugin/” on your server and Activate like other normal plugins. It’s that simple!

next, The client. I don’t like this written in C#, window only and  with no source client. so… I made It again!?

unfortunately, I had never used XML-RPC. :$

but, fortunately, I heard cau use XML-RPC with python! so found XML-RPC in Python on ONLamp, read it once and can write the code.

yes, It’s that simple! no need to know any tickle about XML.

import xmlrpclib
def getCommentCnt(wpURL, username, password):
    wpSvr = xmlrpclib.Server(wpURL+"/xmlrpc.php")
    return wpSvr.geek.getCommentModerationCount(username,password)

run above function by passing blogURL, adminID and password.

getCommentCnt('http://www.suapapa.net/wordpress', 'admin', 'password')
0

It works greatly! Now I can be disappointed via XML-RPC. Ye~!

T-T