WordPress to Facebook and Back Again

I really wanted, though, for users to be able to comment on blog posts from inside Facebook, with their Facebook identities, and have it work like the OpenID comment plugin (in the sense that the user should not need to provide any authentication info, but it should be derived from their Facebook login).

I think I’ve finally got it it nailed, at least to the point where folks can start testing it.

It will require you to log in (or already be logged in) to Facebook, but you don’t have to add the application to your profile or spam all your friends.

What you’ll see is my five most recent blog posts from this blog, inside a Facebook wrapper. (Can’t include embedded videos, the styles are bit wonked, etc – but it is a start. This is basically just Dave Lester’s plugin).

You should also (this is the new part I’ve hacked in) see the ability to comment on posts – without being asked for a name or url or email address.

Please leave me a comment to test it out. It should, if all works according to plan, pull your Facebook profile pic as your avatar for the comment as well – since your facebook profile page is actually an hCard with appropriate markup (go microformats!).

I believe this will work even for folks who are not “friends” of mine in facebook – but let me know if you run into difficulty.

Once I’ve validated that it works I’ll publish the code. It required me to add at least one file to my theme, and relies on the hAvatar plugin to get the profile pic.

Known Issues:

Sometimes the “autoresize iFrame to content size” bit in Facebook fails, and you end up with a fixed size view into longer content, with no scrollbars. Haven’t figured out what triggers that yet – standard facebook javascript api.

Sometimes you’ll get the “You’re entering comments too fast” error – just wait 30 seconds. Unless lots of people are all trying to do it from facebook at once this should go away. I’ll need to figure out how to unthrottle the comment queue in wordpress for this point.

I wish it were that simple. This is a general question not a Wpbook-related one.

I can’t get your plugin to work: to either post comments, invite friends or add a profile box. It does fit very neatly into the iFrame content area, though. I figured, if anyone would know how to do that when creating a general Facebook application, you guys would.

I’m messing about with the xd_receiver.php file here but I’m not certain if therein lies the answer.

@Boogieboa – not sure what issues are preventing the plugin from working for you – have you tried limiting plugins? It’s ultimately either plugin conflicts or misconfiguration in my experience that prevents a plugin from working.

Fitting the content to width in the iframe is a theming issue – you’d have to have your wordpress theme be “fluid” and able to show well in a skinnier window. This is what wpbook does, in fact, substituting it’s own theme when called inside the facebook context.

WPBook controls the width by providing its own custom theme, located in wpbook/theme/index.php, and using built in WordPress “hooks” to recognize when it is inside Facebook and substitute its own theme for the blog’s current theme.