WordPress XML-RPC publishing in AS3

So I’m trying to write a desktop app to publish posts to a WordPress blog, and I found Reuben Stanton’s WordPress XML-RPC library (for some reason, his site isn’t responding, so here’s the code on Google Code)

Now everything works well, but when I get to publishing posts, something weird happens.

Read More

Here’s my code:

private function publish():void {
    var sel:CuratorBlog=blogSelect.selectedItem;
    publisher=new WPService(sel.url, sel.login, sel.password);
    publisher.addEventListener(WPServiceEvent.NEW_POST, postAdded);

    var p:Post=new Post();
    p.dateCreated=publishDate.selectedDate;
    p.title=txtTitle.text;
    p.mt_keywords=txtTags.text;
    p.mt_allow_comments=1;
    p.mt_allow_pings=1;
    p.description=htmlText; //This is obtained from a richText control. And yes, I have tested that it is being assigned properly

    publisher.posts.newPost(p, true);

    btnPublish.enabled=false;
    cursorManager.setBusyCursor();
}

private function postAdded(e:WPServiceEvent):void {
    var postId:String=(e.data as String);
    Alert.show(blogSelect.selectedItem.url + "?p=" + postId);
    publisher.removeEventListener(WPServiceEvent.NEW_POST, postAdded);
    cursorManager.removeBusyCursor();
    btnPublish.enabled=true;
}

The issue is that the post is created, but without the content.

I am able to see the tags and title in the browser when I open the blog, but it has no content. any idea why? How can I fix it?

Related posts

Leave a Reply

1 comment