Limi’s Concept Zone

coding, ranting and random shizzle

Facebook Wordpress Plugin

As some people might know, or might not, Facebook has the ability to automatically re-post your blog posts into Facebook under their Note application. You can do this for a single blog only at a time, for the settings page for this in Facebook see the Import a Blog page.

After having my posts imported into Facebook for a while people occasionally comment on them, and I had wondered if there was a way to have them displayed in my blog. As people seem to comment more on the Notes in Facebook rather than the real blog articles themselves. After a quick bit of searching around, I found a WordPress plugin, made originally by Adam Hill, and has been updated by Thomas Albright.

So I downloaded that, then uploaded to my blog and with glee entered my settings and pressed the import comments button. To my disappointment the plugin didn’t work . I thought “well ok, its coded in PHP, so lets see how it works”. I tell you this wasn’t a simple to figure out, as its more complex than it appears.

In the end after spending some time playing around with it, and having to constantly log in and out of Facebook to test I got it working. The fix itself was very simple, it wasn’t so much a code error, or a major change to the Facebook site that caused it to break. Obviously Facebook developers had been alerted to this plugin and decided that they didn’t want this, quite frankly really quite nice plugin, to work any more. So they decided to start tinkering with things. Nothing drastic, and nothing that changes the way that the page is shown to the user. All the HTML code remained unchanged except for some very.. VERY.. sly changes.

Now before you jump to conclusions, it wasn’t extra div’s, extra line breaks here or there, or even re-structuring the code. This adjustment had to be done in a way so that the original coder would look at the source of the page and see no modifications, and that the only difference was that before the plugin worked, and now it doesn’t. So what’s the easiest way to do that?

Whitespace! The simple addition of a single space in select parts of the HTML markup caused various and important regex’s within the plugin to fail, and therefore would no longer be able to read and distinguish comments on Facebook. So all it took was to see what they were before, easily done by examining the regexp’s, and then comparing that to the current source code you see on the site. From that you then fix the regexp for this new tinkered-with-code and away it goes again!

So a hello goes out to the random Facebook developer who ends up reading this as they get ordered to fudge it again. You could however, instead of doing that again, add functions to the Facebook API so it could be done legitimately!

If you wish to test this plugin, simply reply to this note on Facebook and it will appear on the article page within about an hour. (It updates on the half-past the hour)

Anyway, if you want the new fixed version of this plugin you can download it just below…

Download

Download - WordPress Facebook Notes Plugin

Share This

Comments

  1. Limi
    October 2nd, 2007 | 3:17 pm

    Please leave comments on the first article, this can be found here…

    http://blog.trustedadmin.net/2007/08/31/facebook-note-comments-to-wordpress-comments/#comments

Leave a reply

Close
E-mail It