WPBook 0.9.7: Share Posts, Ease of Installation, Add to pages

I’ve just released version 0.9.7 of WPBook (a WordPress plugin to bring blog posts into Facebook and enable comments from Facebook users) here and at the WordPress site.

A few changes since 0.9.3, the last version I blogged about (the most recent version can always be found on this page or at the WordPress site):

Share Button. This version adds a Facebook style “Share this post” button next to each blog post in Facebook, which allows the user to send the posts to Facebook friends or post and individual blog entry to their profile.

Here’s what the share button looks like, in context:

Share Button for Post inside Facebook
Share Button for Post inside Facebook

And here’s the resulting popup, with the “post to profile” tab active:

The resulting Popup with 'Post to Profile' active
The resulting Popup with 'Post to Profile' active

Ease of installation and Update. Earlier versions required the user to add a directory to their /wp-content/themes/ directory. In this version, and moving forward, the plugin carries the theme directory inside it. Among other things, this means that the “update automatically” function from inside the WordPress plugins page will now work with no additional effort on the user’s part.

Add to pages. The directions have been clarified with respect to profile page boxes. If you want users to be able to add your Facebook Application to Pages as well as user profiles, you will need to enter some FBML (provided by the plugin, on the settings page) in Facebook.

Facebook Settings for Pages, with Default FBML (Note: FBML here is for this blog - yours will be different)
Facebook Settings for Pages, with Default FBML (Note: FBML here is for this blog - yours will be different)

No Conflict with other Facebook Plugins. Using multiple Facebook plugins on your WordPress blog can lead to problems, as each includes its own copy of the Facebook client libraries. This version now checks for the existence of other libraries and relies on those already present if they have been declared.

Plans for 1.0:

For the impending 1.0 release, here’s what I plan to do:

  1. Make the “share” button a setting, enabling users to turn off the functionality if they choose.
  2. Provide a link to the “original” version of each blog post (outside Facebook) – also optional
  3. Add a small “powered by WPBook” type link to the bottom of the canvas page – with option for user to disable.

I also plan to update the page for the plugin here and at WordPress with some screenshots to accompany the documentation, but that might not happen until after the plugin is released.


  1. This is returning null:

    $rs = $facebook->api_client->fql_query(“SELECT name, pic FROM user WHERE uid = “.$user);

    in comments.php

    $user is set with a #

    dunno why

    pretty cool so far though!

  2. Not sure I understand what you mean. The $rs returned from that query is used further down comments.php (line 88) to display and store the user’s name for the comment form.

    Is that not working in your installation? Are users able to leave comments from the Facebook side?

    If it is returning null, it may be an issue of the facebook client failing to initialize, which may cause other problems as well – what’s the URL of your facebook app?

  3. There is a problem in the php5 client that you are distributing with this application. It has a bug in it. It is in the rest php code.

  4. Shawn – can you be more specific? What’s the symptom of the bug?

    The php5 client I’m distributing comes directly from Facebook’s developer wiki, and I’m not seeing any behavior in the app that would suggest to me that it has a bug.

    (I’m not saying it doesn’t have a bug, just that I haven’t seen any behavior that doesn’t work in the parts of the API I’m using. Have you?)

  5. Sorry, I tried to post a link here but it never works.

    Search the developer forums on facebook for

    API Broken – empty string reponse, non-curl only

    It was entered today.

  6. Not sure what issues you’re having with links, but you mean this forum thread?

    Looks like that causes a problem on servers without curl installed – perhaps that’s why I haven’t seen it yet.

    I’ve added in the suggested fix on my local copy, and will deploy it with the next release of WPBook, but there may still be issues for some folks who have other Facebook-related plugins which also include the library, and may have non-updated versions.

    Thanks for the heads up.

  7. That is odd. Is the app set to iframe, in the facebook settings? What have you supplied as the Canvas URL?

    Basically the plugin looks for a querystring parameter (fb_sig_in_iframe) which Facebook automatically adds to the callback url you provided when you set up the application.

    Might be some kind of plugin conflict – can you try eliminating other plugins?

    Do you have something custom set as a front page?

  8. Thanks for the reply. I got it to work.

    I first changed my theme to a couple of different themes with no change.

    I then set my permalinks to the default ? links. When I did this, I got a fatal error for SimpleXML. This led me to realize that I was using PHP 4.x. I changed to PHP 5 and all is well.

    I put my permalinks back on.

    Thanks for the help!

  9. Hi, I am using my wp 2.7 and wpbook 0.9.7.
    I just configured the wpbook settings using api and secret keys, and on canvas I just wrote the name of the application – it said “NOT INCLUDED APPS.FACEBOOK.COM” so I just wrote ilviruscheparla
    The error I am getting, is this:
    Warning: main(simplexml44-0_4_4/class/IsterXmlSimpleXMLImpl.php) [function.main]: failed to open stream: No such file or directory in /home/mhd-01/www.ilviruscheparla.org/htdocs/wp-content/plugins/wpbook/php4client/facebookapi_php4_restlib.php on line 34

    Fatal error: main() [function.require]: Failed opening required ‘simplexml44-0_4_4/class/IsterXmlSimpleXMLImpl.php’ (include_path=’./:/usr/share/php/’) in /home/mhd-01/www.ilviruscheparla.org/htdocs/wp-content/plugins/wpbook/php4client/facebookapi_php4_restlib.php on line 34
    I uploaded the whole directory on wp-content/plugins and activated the plugin from admin panel.
    the canvas URL is http://apps.facebook.com/ilviruscheparla
    thanks a lot

  10. @hivlinux – you’re using PHP 4, and when used with PHP 4, the app requires the SimpleXML library.

    You can get the SimpleXML library backported to PHP4 here: simplexml44

    And put the whole “simplexml44-0_4_4” directory inside:

  11. FYI – I also plan to add this library to the next release – if you’d prefer to just wait, it should be later today.

  12. Hi, and thanks for a great plugin!

    I realized that one can give the callback URL for, lets say, a category, and thus get only the posts for that very category on the facebook page.

    Is it possible to run two instances of WPbook, and get two categories listed as separate blogs on facebook? I’d like to run a general (with all the topics) as well as a specific one for targeted users.


  13. @Patrick – thanks – glad to hear you’re liking it.

    I’m actually going to close comments on this post as it is specific to 0.9.7, and we’re up to 1.2 now. (See the release announcement for 1.2).

    I think using a category page as a callback URL may cause problems for you with the “invite friends” link if you’re showing it – but maybe not. It’s a use case I’ve never tested, is all.

    It certainly won’t work, as currently written, with multiple instances. You could potentially create a copy of wpbook, namespace all the functions, and run two alongside each other. (WordPress would have to see them as separate plugins – different name for wpbook.php, different folder, and no conflicting function names).

    It should be possible, in other words, but I don’t see it ever being a feature in a “supported” or “official” release of the plugin.

Comments are closed.