WPBook 1.5 Released – Let the Streaming begin!

WPBook

So for a while I’ve been working on and beta testing the next version of WPBook. Tonight I’ve just tagged it for release, so it will be available for download shortly. (I’ve already been running it here for a while and testing it on a few other test blogs).

The main improvement in WPBook 1.5 is that it now knows how to use stream.publish, meaning that it will automatically post to your wall in Facebook when you publish a post in WordPress. Your friends should see that notification as well in their streams. (We’re not, however, sending application updates or tracking all users’ user id’s – instead you enter your own userid into the settings and it uses that to post to your wall). Included are attachments (first image attached to the post is used) and excerpts (if you hand craft excerpts they will be used in the wall post).

The other main improvement is that WPBook now requires PHP5, and as such can wrap Facebook calls in Try/Catch blocks. For the non-programmer, this means those awful, dramatic “fatal uncaught exception” error screens are gone. WPBook isn’t doing anything terribly meaningful with those errors yet – still working on that- but at least it traps them.

In this release:

  • WPBook now requires PHP 5
  • Enables user to post to stream, including to pages. (Must be pages for which you are the admin, to which you have added the app, and which have granted stream.publish permission – link provided in the admin to grant permissions.
  • Catches exceptions thrown by the Facebook client. (Doesn’t yet surface those in good error messages, but at least they are caught)
  • Fixed, I hope, issue with comments inside Facebook for some users
  • Clean up of some admin styles (resized gravatar images as well as some basic hierarchy on options)
  • Added Page Options as their own section
  • Allow user to select pages to be excluded
  • Added option to allow a menu of parent pages at top of the app below the title
  • Fixed “Facebok” typo in line line 182 of theme/index.php
  • Option to turn on and off page list under content (independent of menu)
  • Option to turn on/off recent post under content
  • Allow user to set the amount of recent post to show under content (default 10)
  • Cleaned up custom header/footer now only one function instead of two (no reason to have two functions)
  • Added %tag_links% and %category_links% to custom header footer as well as made archive pages work.
  • Set smart default for when Blog Title isn’t set

Next steps?

  • Better error handling code – do something with the messages Facebook returns when an exception is thrown
  • User selectable theme directory – for users who’ve taken the time to customize their theme
  • Threaded comments – likely means requiring WP 2.7, though for error handling (and just simplicity) I’m thinking of jumping right to WordPress 2.8
  • Cross-Posting to a commenter’s wall when they comment inside Facebook. (Because it is in response to a user action, I understand they don’t even have to grant stream.publish permission).

What else would you like to see?

Update: Closing comments on this post. For troubleshooting please use the support forums instead.

48 Comments

  1. Hey I’m having some problems with the stream functionality:
    When I click the “click here to grant WPBook the permission to publish to your stream.”
    It gives me a new tab with some text and the intended link but further down on the page it says:
    “You are also listed as the admin of these pages:
    Warning: Invalid argument supplied for foreach() in /var/www/sites/ps3expert.dk/public_html/wp-content/plugins/wpbook/theme/index.php on line 75”
    Also, when I click the “Click here to trigger extended permissions dialog box” link it gives me the top of a permissions box, and then just gives me the page again without the surrounding facebook frame.

    Bottom line: My streams don’t work.

    Suggestions?

  2. JetaR – hmm, forgot to test with a user who is not a page admin of any pages.

    When the page reloads without the facebook frame around it, can you still click on the ‘Click here to trigger extended permissions’ link? If you do, does the permissions dialogue box open?

    I will add a check for empty results for the foreach loop that is throwing the error.

  3. JetaR – just checked in a fix and tagged it 1.5.1 – not sure how quickly the repository will show it.

    Auto update inside WordPress only checks once every 24 hours I think, but you can grab it from the repository at wordpress.org/extend/plugins/wpbook

  4. I’m getting the following error every time I publish a post now that I’ve turned on the streams functionality:

    Fatal error: Call to undefined method FacebookRestClient::stream_publish() in /homepages/16/d92277137/htdocs/wordpress/wp-content/plugins/wpbook/wpbook.php on line 899

  5. Hi John, thanks for the speedy reply.
    same error with 1.5.1.
    And the first time i clicked the link in the facebookless window i got the dialog, subsequently i just get booted to the front page og my app. which I guess would be working as intended.

    When I post I also get the “Fatal error: Call to undefined method FacebookRestClient::stream_publish() in /homepages/16/d92277137/htdocs/wordpress/wp-content/plugins/wpbook/wpbook.php on line 899”
    I just thought it was i fluke, thus it was not mentioned in the first post. Sorry about that.

  6. Erhhh… not entirely the same message, mine’s:
    “Fatal error: Call to undefined method FacebookRestClient::stream_publish() in /var/www/sites/ps3expert.dk/public_html/wp-content/plugins/wpbook/wpbook.php on line 899”

    Note to self: Think before writing so as to not spam poor john.

  7. I’m getting something different. A little help and or how do how do I revert to the old version.

    Parse error: syntax error, unexpected ‘{‘ in /home/content/a/s/i/asiamahd/html/CTM/wp-content/plugins/wpbook/wpbook.php on line 842

  8. Hmm. Is it possible you are using another Facebook Plugin, like the FB Connect one?

    It seems like you have an outdated version of the Facebook Client, which does not have the streaming in it.

    If you are using another FB related plugin, try disabling that first.

  9. Deactivating WP-FB Connect does the trick… any recommendations as to which “log on to my WP with your facebook” plugin works with WP book?

    Btw is it possible to change the text that is “streamed”? The name of the person is shown twice:
    “Henrik Jacobsen Henrik Jacobsen has published a new blog post at PS3expert.dk”
    The first one is the FB name link the other is plain text.

    Also: I’d be cool if the app could push updates to the members stream, I read that you choose not to do this, why?

  10. Don’t know – I don’t use any “log onto my WP with your Facebook” plugins.

    The issue isn’t that plugin, it’s that the plugin includes an outdated version of the Facebook client library – you could probably replace the Facebook client they provide (in some kind of /client subdirectory) with the one from WPBook and re-enable.

    Pushing updates to the member stream requires:
    1. Each of the members to grant the app permission to publish to their stream
    2. WPBook to keep track of all the uids of all the users who have granted permission

    Wouldn’t rule it out in a later version but figured it made sense to start with the core use case which is the author.

    To change the text streamed, look at line 858:

    $message = $my_author .’ has published a new blog post at ‘. get_bloginfo(‘name’);

    It’s only the same in your case because you are publishing to your own wall – if you also published to a Page’s wall, you’d see something different (or if another author on your blog posted).

    Next step I think is to accept an array of uids in the admin – this would let multiple authors work.

  11. The problem and resolution are confirmed. Disabling the FaceBook Connect plugin allowed WPBook to function correctly.

    Thanks!

  12. 1.4.2 now. I can’t remember if I ever made it to 1.5 but I know 1.51 didn’t work and when I stepped down to 1.5 I had the same issue. The frame didn’t fit. Requiring one to scroll to the right to experience the whole page. Any ideas why it didn’t fit? At any rate its an awesome program. Thanks much for developing it.

  13. I’ve been waiting for WPBook 1.5 for a long time. Thank You for that job John!

    I have a problem. Whenever I’m trying to connect WPBook with FB I get that info:
    “his page has NOT granted stream.publish permissions to this app”

    Where can I change that?
    In page preferences I have only “Publish last activity”, no “publish stream”. Am I able to change that?

  14. Esp – you change that on exactly the same page where you are seeing it say “this page has NOT granted permissions.”

    In WPBook’s settings page inside your WordPress install, there is a link which says “click here to grant WPBook permission to publish to your streaam”

    Click on that link, and in the page that loads, click on the link which says “Click here to trigger extended permissions dialog box”

    In the dialogue box that opens, there is a dropdown labelled “Allow setting for: ” and a list of the pages for which you are an admin.

  15. Esp – if your posts are published to your “boxes” tab, that’s the old mechanism, which has been around since 1.2 I think.

    The new stream.publish based option will show up on your wall.

    So when you go to the “Click here to grant WPBook permission to publish to your stream” is the page to which you are trying to publish listed? Does it say permission has been granted?

  16. Hello John, thanks for the wonderful plugin. I got it installed, everything seems to be working except my latest blog posts do not show up in my Facebook wall, instead they show up in the “box”.

    You mentioned in the reply above “Click here to grant WPBook permission to publish to your stream”… where do I look for this setting?

  17. Ignore my earlier question. I have found the link eventually — it is in the WPBook settings page in my WordPress blog, under the header of “Stream Publishing Options”

    I kept looking at the settings in my Facebook, that was why I couldn’t find it. Thanks again for the great plugin! Love it already!

  18. Yes it does. It says
    “You are also listed as the admin of these pages:
    * Z?omnik (209438124617), This page has granted stream.publish permissions to this app”

  19. Wait a second… I spoke too soon. Although I have clicked the permission link, which seems like I have set it correctly, my posts still do not show up in my Facebook: neither in Wall or News feed. What am I missing here?

  20. Dean – have you also added your Facebook profile ID number to the appropriate spot in the WPBook settings page (in WordPress)?

    Have you also published a new blog post, or unpublished and existing one and published it again?

    Stream.publish will only work for posts pubished *after* you’ve activated the checkbox in WPBook setings, filled in your user profile id in WPBook settings, and granted permission.

  21. Esp – I assume you have added your FB profile ID to the WPBook settings (in WordPress) and checked the “publish new posts to Facebook stream” box?

    Have you posted new blog posts since granting permission, checking the box, and adding your user profile to the WPBook settings?

    I hope to release this weekend a version which does a better job of exposing the error messages that come back from Facebook when stream.publish gets called – maybe a debug switch

  22. @John still no luck. I have entered the correct Facebook profile ID (a long string of numbers), and I have tried republishing old entries as well as adding new entries, none came up on the wall.

    It got me thinking: should I expect to see the “stream” in my News feed (main Facebook landing page), or my Profile page, or my application profile page, or the actual application page (apps.facebook.com/xxxx)?

  23. @Dean – your “stream” posts should appear in your profile page – as though you had posted them. They may also appear in your friends’ News Feeds.

    You should also seem the posts on the application page, but that is functionality core long before 1.5 – that’s how WPBook has always worked.

  24. @Dean

    When you go to your WPBook settings inside WordPress, is the “Publish new posts to Facebook Stream” checkbox checked?

    When you go to the url linked from that spot in WPBook settings (“click here to grant WPBook the permission to publish to your stream”) what do you see on that page?

    Is that the profile ID you’ve entered into the profile ID box in WPBook?

    Did you click on the “Click here to trigger extended permissions dialog box” link, and did yu get a dialogue box from Facebook telling you an app was requesting permission to publish to your stream?

    (You can also check by going in Facebook to My Account->Application Settings and then clicking on “Edit Settings” for your app, and looking at the “Additional Permissions” tab of the resulting dialog box – it should have a checkmark next to both of these: “Access my data even when I’m not using the application” and “Publish to streams.” If this is not set then you have not yet granted permissions).

    Ignore the application profile for now. The application itself looks like it is working fine.

    If the above tests show that you *HAVE* successfully granted permission and your FB profile ID is correct, you’ll need to run a special debug build for me to see what error FB is returning.

  25. @John

    “Publish new posts to Facebook Stream” is checked all along.

    Have also clicked the link that goes to the grant permission page, copied and pasted the userID back to my WordPress settings.

    However, when I clicked on “Click here to trigger extended permission dialog box”, the dialog box did pop up, showing that it was loading, but before it finished loading, the entire page was refreshed into a blank page, displayed the same block of text as previous, that says “This page is just for the author of the blog to grant extended permissions.

    Your userid is XXXXXXX

    You will need to enter that number into WPBook’s settings page on your WordPress install…”

    I believe this is the part where things stopped working. I have tried using different browser to no avail. My default browser is Safari. Have tried Chrome.

  26. Further more, when I looked at application settings in my Facebook account, under Additional Permissions I can only see a checkbox with label: “Publish recent activity (one line stories) to my wall” which is checked. The other two settings were not there.

  27. So when the second, blank page comes up which contains the “trigger permissions dialog box” link on it, have you clicked that one?

    Can you try it in Firefox?

  28. Clearly what’s failed is granting stream.publish permission – until that permission is granted WPBook will not be able to publish to your stream.

  29. The mystery is solved!!

    Know what was the problem? It was the Connect URL that I’d missed! I entered the URL of my blog and viola! Everything is in order now!

    Thank you so much John, for helping with the troubleshooting. Hats off to your professional attitude! Tell me, how can I buy you a beer? You have a PayPal account?

  30. I automatically updated to 1.5.1, but activation failed. This is the error: Plugin could not be activated because it triggered a fatal error.

    Parse error: parse error, unexpected ‘{‘ in /home/sites/site134/html/blog/wp-content/plugins/wpbook/wpbook.php on line 842

    Ideas?

  31. Hmm. Might be some kind of file corruption while upgrading? Try removing all the plugin files (uninstall/remove) and re-installing?

    Did you ever run 1.5, or was it only 1.5.1 that had the error?

    Is your host running PHP 5?

  32. You mean the “Connect URL” setting in Facebook? (Facebook “developers” app, edit application settings, Facebook Connect section?)

    I did not even realize that was required – but that’s great to know.

    Thank you for continuing to try – hope it will help others.

  33. So I’m the only one who cannot establish WPBook properly. I did everything again today, checked 3 times and still no effect.

    connect URL is ok, Click here to grant WPBook permission to publish to your stream – done, proper ID pasted in box and still nothing. Should I wait for debug then?

  34. I wouldn’t say you’re the only one who can’t get it working, but I do know myself and others have gotten it working – so the issue is trying to narrow down what is different about your setup.

    I will push out a build with debug options this weekend, which should capture whatever error is preventing yours from working. (I’m assuming Facebook is returning some kind of error to the stream.publish call).

    Do the posts get published to your personal profile (seems the link you sent before was to a page)?

  35. No, they don’t. I granted permission to page and my profile and posts don’t show up at any of them.

  36. Shame on me, I found the answer: I put my page ID instead of mine ID at the WPBook. Everything is working now. Thanks for help John.

    I still have two questions:
    1. Should my page fans get info on their walls that there’s something new at my page? I’m a fan of my page and when I wrote new post it shows up at the fb page, but me as a fan didn’t get any info on my wall.
    2. Is it possoble that WPBook publish the miniature of photo or Youtube clip that I included in blog post?

  37. Hi JetaR, I’m also using WP FB Connect. However, I have no idea how to “replace the client library”, can you help me out here?

    Thanks.

  38. HI John,
    Great work on this plugin!

    I’m running 1.51

    I’m also having problems posing to my own facebook stream. I have the same problem described above by JetarR when I click the ‘grant wp permission’ link in the settings. It takes me to facebook but shows this error…

    Warning: Invalid argument supplied for foreach() in /home/rogerhow/public_html/wp-content/plugins/wpbook/theme/index.php on line 75

    despite this I can still click the ‘trigger extended permissions’ and it takes me back to the app page.

    Then when I post a new item on my wp page (afsradio.com) it IS published on my facebook, BUT if I log out of facebook then post on my wp I an error beginning…

    Fatal error: Uncaught exception ‘FacebookRestClientException’ with message ‘Session key invalid or no longer valid’ in /home/rogerhow/public_html/wp-content/plugins/wpbook/client/facebookapi_php5_restlib.php:3065 Stack trace: #0 /home/rogerhow/…

    Any idea what’s going on here?

    I am admin on the application page (http://www.facebook.com/apps/application.php?id=407482068168)

    Thanks for your help!

  39. Great work on this plugin!

    I’ve got a similar issue to Jetar, I get the same error on the ‘grant permissions’ page. Although I am admin on the app facebook page (http://www.facebook.com/apps/application.php?id=407482068168)

    weirdly my streaming to my facebook works when I’m logged into facebook but I get this errorwhen I post on WP and I’m not logged in to Facebook…

    Fatal error: Uncaught exception ‘FacebookRestClientException’ with message ‘Session key invalid or no longer valid’ in /home/rogerhow/public_html/wp-content/plugins/…….

    Any help much appreciated!

  40. Somehow it seems you have not granted the “offline updates” permission, perhaps for the page?

    Are you trying to get the updates to post into your *personal* Facebook profile, or the profile of a Fan Page?

    Have you added the profile box to your Facebook page? (Enable “show add to profile box” in the WPBook settings and then load your app and use the “add to profile” box).

    It may be that I’ve inadvertently skipped a step here – that adding the profile box grants a permission necessary for stream publishing.

Comments are closed.