Start OPML Editor support for WP

I’ve gotten some emails from people who seem like they might know what they’re doing on the insides of WordPress, so I’ll play along and start the bootstrap from the OPML Editor side of things (hoping some OPML Editor users or developers pitch in when they see questions they can answer).

The very most basic call you need to support is something like this (or exactly this if you want to keep the client side changes minimized).

opmlCommunityServer.saveFile (blogid, username, password, path, bytes)

It creates or overwrites a file in a server-side OPML store associated with each weblog.

The first three parameters are the usual params for the MetaWeblog API.

path is a forward-slash-delimited path relative to the root of the weblog’s folder where the bytes will be stored.

If I wanted to store my blogroll, it would go to blog/decorations/blogroll.opml. That’s the convention for where the blogroll is located.

In WordPress, blogroll.opml is read, compiled into the internal WordPress structure (a relation?) and all pages that include it are caused to recalc if necessary (not sure if all pages are fully dynamic).

That’s the single XML-RPC call you need to make this stuff work minimally. Later, for extra credit, there’s deleteFile. The folder synchronizer notes when local files are deleted and deletes them on the server using this call.

Any OPML Editor user can tell you where the other files live, by just looking in their www folder. And any implementor that tries to do the WP stuff without at least installing the OPML Editor app and posting a hello world message to the blog is working way too hard and probably wasting a lot of other people’s time. Imho. šŸ™‚

13 responses to this post.

  1. Just so we are crystal,

    will be accepting a call to a method named opmlCommunityServer.saveFile

    with the metaweblog api stuff +

    the path to the OPML file on the WordPress site (relative to blog root) (a string?)+

    ?? what is bytes repesenting and what kind of xml-rpc datatype is it?


  2. The path is indeed a string, and bytes is a string too.


  3. Just a note for implementors, the XML-RPC function list is pluggable using the xmlrpc_methods filter so this can be implemented entirely as a plugin.


  4. See here for some quickly hacked together code that will let the OPML Editor send a blogroll to WP and have it replace the existing one:


  5. Great. It’s close to what I’ve got. I use a different OPML parsing method
    What I think you need is:

    $wpdb->query(“DELETE FROM $wpdb->links WHERE link_category = 1”);

    The Blogroll almost always has a category id of 1 and this is what if referenced by the link_category field. This way only the blogroll lkinks are removed.

    My version (which I hope to have later today) may actually do some mor thinking on whether to delete, update, or add the link. For the flat Blogroll, it probably works just as well this way.
    But it may have implications for further OPML formats and methods we wish to call.
    Good Work!!
    One question.

    Did you get this to work with the Editor already? If so, just by aadding your blog to WordPress.root? Or how?

    Uhhh… I guess that’s more than one question : )


  6. Sorry nevermind, I’m reading your instrucstions now. Cool.


  7. nevermind, I’m reading your instructions now. duh


  8. Here is the Remote OPML Enabler (ROPE) plugin for WordPress. I’ve already got some improvements and changes in mind, but figured I’d release it and continue working.

    On a side note, if Dave were to use this, then it would be like Father Guido Sarducci’s SNL skit, “The Pope on a Rope”


  9. Okay, I was thinking about what great potential having the editor update remote files like the WordPress Blogroll, but it stinks to have to have Dave create an extension evertime someone envisions somthing new.

    I don’t know if this idea is feasible, but I was thinking that the Editor could have a special type of file. A “live” file.

    For thes files, the editor stores the xmlrpc location and the params for opmlCommunityServer.savefile on a per file basis.

    That way any service in the world that accepts OPML can have an end user simply add their service information to their particular OPML file.

    the editor can already fetch OPML from anywhere. Now it should be able to “put” it anywhere that accepts it.

    What do yall say?


  10. PER file basis is the key here.


  11. Okay, now I’m confused.

    Slow down. Let’s take a deep breath, and let us reason together.

    I want to edit the blogroll.

    So I open the blogroll from the Community menu and edit it.

    It upstreams.

    You note that it’s upstreamed.

    Now you update the wordpress blogroll.

    What could be simpler?

    Why make it more complicated?

    How about going back and *carefully* reading my initial posts on this.

    I really think I laid out an architecture that works.

    But this must all seem very strange to you.

    But it has a logic to it.

    I wouldn’t try to reinvent the architecture of wordpress, I want it to be a black box. You should try to view the OPML Editor the same way.

    šŸ™‚ šŸ™‚ šŸ™‚ šŸ™‚ šŸ™‚ šŸ™‚ šŸ™‚ šŸ™‚


  12. Fair enough, but I think I’m speaking up there as an OPML editor user, not a WordPress hacker.

    You’re right though, I need to calm down. I can’t seem to lately and since you created OPML, it’s your fault.

    Let me put it this way. If I have two WordPress blogs and I want to edit each blogroll, do I need to edit……what’s that file again?

    I, as a Media Hacker, want to create services that the Editor can speak to.

    I, as an OPML editor user, want to easily be able to switch between these services.

    But I get your point. I’m calm now. We are working on WordPress integration here.

    So here are a few pressing questions.

    Version .2 of the plugin is coming along. It requires a Wordpess User and Pass
    to be the same as the one’s stored in the Editor.

    1. WordPress dynamically creates the OPML export of a blogroll, typically at wp-links-opml.php Is this the path argument that the editor should send? there is no path to a static opml file. In my testing, the editor was sending blog/decorations/blogroll.opml as the path. Doesn’t seem right. Do I edit dotOpmlData.root (got it this time : )) for this value as well.
    2. What args should opmlCommunityServer.deleteFile accept? Same thing, I guess.

    Thanks for setting me straight Dave.
    [But I still have secret plans for non-wordpress services that accept opmlCommunityServer.saveFile]


  13. Cooooool.

    I’m equally excited about wordpress.

    But first, before talking to any of the others, Dave the developer and Matt the developer have to spend a few weeks living in pure user hell, while we figure out how to connect these two massive code bases with different cultures together while living lives and doing other things, and not going crazy.

    And now I have to go to bed. Whew! šŸ™‚




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: