Beta Testers Needed for WPBook

Test Boxes, photo by David Bleasdale, cc-by license

I’ve just tagged version 2.0.0 of WPBook for release, but haven’t yet changed the “stable” tag in the readme.

What that means is that if you’re using WPBook, you won’t seen any automated notification of a newer version being available. You’ll have to go to the WPBook download page and find 2.0.0 at the top of the “other versions” list.

Please do so, especially if you are willing to help test the new features.

What is there to test? Most importantly, a new feature which imports comments made by users on your Facebook wall (or the wall of a Facebook page) in response to excerpts posted by WPBook on those pages.

In other words, if you have “publish to Facebook Stream” enabled and working for your personal wall and/or the wall of a Fan Page, when you publish a new blog post, and that post gets published to the FB wall, and users make comments on that wall post, those same comments will get imported to your WordPress hosted blog.

A few notes:

  • You’ve got to have stream publishing working in order for importing to work. For the last few versions, I’ve had the app request “stream_read” permissions as well as “stream_publish” – so it should have the right permissions. If it doesn’t, visit the “click here to grant permissions” page from the WPBook settings and try regranting them – it can’t hurt and it might help.
  • Comment importing relies on wp_cron, WordPress’s built in pseudo-cron system, which basically lets timed events happen in the background. (It’s the same thing that makes scheduled posts work). In order to get WPBook’s necessary hooks added to wp_cron, you will need to deactivate and then reactivate the plugin.
  • In case you weren’t listening above, you will need to deactivate and then reactivate the plugin for commenting importing to work. Comment importing is a task which fires off hourly, so don’t expect any comments for the first hour or two.
  • Comment importing will only work for new posts, or more accurately, posts published to your Facebook wall AFTER installing 2.x. Posts you had previously posted to your Facebook wall will not have their comments imported.
  • Comment importing also only works for posts published within the last 7 days (user configurable). Basically this is a potentially taxing operation, and it’s my experience that most comments on a Facebook wall are made within the first 24 or 48 hours of a post being made, so there isn’t much point in going back longer than 7 days.
  • You can configure (in the expected places in WPBook settings) whether comments imported from Facebook should be automatically approved, and what email address should be affiliated with them. (This is different than comments made inside the Facebook Application version of your blog, where users can input their email adress. The comment form for wall posts doesn’t allow for email, and doesn’t grant the application permission to pull the users email). This is so that you can set a gravatar to be used for imported posts (just set the email address to one you control, then set a gravatar for that email address).
  • There is a debug mode, enabled by changing define ('DEBUG', false); to define ('DEBUG', true); at line 37 of wpbook_cron.php. (If you’re not comfortable changing this, perhaps you shouldn’t beta test plugins.) This will create a wpbook_debug.txt file inside the plugin’s directory which captures information about every time cron runs.

Additionally, this version also includes the often requested “Promote External links” option – if checked, this will cause WPBook to use your external (WordPress) permalinks for new posts, both in the “Recent Posts” box in your profile and also in the Wall notifications, so users are sent to your WordPress blog, not to the Facebook Application view of your blog. In essence this lets you use WPBook without ever expecting users to go to your Facebook Application, which is now just used as a mechanism for connecting WordPress to Facebook for the publishing of new posts and the importing of comments.

If you are testing it, please let me know by commenting here or posting in the support forums for WPBook and thanks in advance!

13 Comments

  1. Thanks Steve – as you’ll see if you check it out I took a slightly different approach, storing the stream_id Facebook returns in the wp_postmeta table associated with the post to which it belongs. Then in the cron job I iterate over all the posts in last X days (user configurable) which have the appropriate postmeta values, and get comments for those.

    Did you notice that wp_new_comment() always overrides whatever timestamp you pass it? Comments are always marked with the time they are passed through wp_new_comment() rather than the time you pass it – so I went directly to wp_insert_comment() which puts ’em directly in the database, but potentially bypasses some filtering and notifications.

    I’m thinking I may have to do the filtering and notifications myself – also need to avoid the throttling (anti-comment-flood protection) that wp_new_comment does when it call wp_allow_comment.

    I also found that some of the FB API calls weren’t working for me so I changed some to FQL queries (rather than getUserInfo for example) – getting the name and profile url from the profile table directly.

    Anyway, thanks for the great example and structure for the code – check it out and see if you have any recommendations based on how I’ve altered it – I’m all ears. ;)

  2. I used to use wp_insert_comment but people complained because it “broke” some other plugins. The other thing I found moving back to the “proper” way of doing it was that the parameter to auto approve a comment is ignored and so comments get pushed into the approve queue, until of course you approve enough that WordPress decides that email address is “good”.

    I like the way you’re storing stuff in the Post Meta. I started using it for the wordbooker options so that each post remembers the specific wordbooker options for that post.

    What happens if someone republishes a post? I think that your code will mean that comments made on the original post on the FB wall wont get picked up?

  3. Interesting – having some trouble getting consistent results from FQL queries.

    If I run this query:
    SELECT comments FROM stream WHERE post_id='1825518_756429407259'

    in the FQL.query test console, I get back 2 comments:

    {
      "comments": {
        "can_remove": true,
        "can_post": true,
        "count": 2,
        "comment_list": [
          {
            "fromid": 892645194,
            "time": 1278536439,
            "text": "Well I did wonder what was going on. I'm surprised it didn't blow your FB post quota.",
            "id": "1825518_756429407259_1275718"
          },
          {
            "fromid": 1825518,
            "time": 1278536500,
            "text": "Yeah, it should have. Not sure why it didn't. ",
            "id": "1825518_756429407259_1275726"
          }
        ]
      }
    }
    

    But, when I run that same query inside WPBook’s cron function, I get only one comment (ran through print_r):

    (
      [comments] => Array
        (
          [can_remove] => 0
          [can_post] => 0
          [count] => 1
          [comment_list] => Array
            (
              [0] => Array
                (
                  [fromid] => 1825518
                  [time] => 1278536500
                   => Yeah, it should have. Not sure why it didn't. 
                  [id] => 1825518_756429407259_1275726
                )
            )
        )
    )
    

    It only returns a single comment, not the two that I know are there.

    If I try to use FQL to query the comment table directly for the same stream_id, I get 2 comments in the test console but a blank response in the app itself.

    Anyone got any ideas?

  4. By the same token, if I run this query:

    SELECT time,text,fromid,xid,post_id FROM comment WHERE post_id='1825518_756429407259' AND time > '1' ORDER BY time ASC

    Against the comments table in the test console, I get:

    [
      {
        "xid": "",
        "fromid": 892645194,
        "time": 1278536439,
        "text": "Well I did wonder what was going on. I'm surprised it didn't blow your FB post quota.",
        "post_id": "1825518_756429407259"
      },
      {
        "xid": "",
        "fromid": 1825518,
        "time": 1278536500,
        "text": "Yeah, it should have. Not sure why it didn't. ",
        "post_id": "1825518_756429407259"
      }
    ]
    

    But running the same query in the app:

    $facebook->api_client->call_method('facebook.fql.query',array('query' => $fbsql));

    Results in just a null response.

  5. What’s even more off is that the FQL for comments worked fine on my test blog but not on this one – and it throws no exceptions!

  6. As each and every day passes its becoming more obvious that the whole FB platform is actually pretty crap – FQL queries doing things that that, queries on the Status table failing due to FB internal resource limits…..

  7. Hate to say it, but in this case at least it’s developer error (mine).

    I haven’t been storing the “session secret” that gets returned when a user grants “offline access” permissions (it isn’t necessary for stream_publish to work, but is necessary for get_comments and for these fql query calls. I was just creating a new client with my api key and app secret, but not using the user’s token.

    I’m going to have to change how WPBook requests those permissions in order to store that token – maybe I’ll just switch over to oauth and the new client library at the same time.

    Interestingly, for reading the page’s stream, this doesn’t seem to be an issue. So folks cross-posting to Facebook Fan pages, those can be read. (Maybe this is a privacy setting at the Fan Page level? Or may fan page streams are always public?)

  8. I downloaded the 2.0 release to my test site and wanted to provide some feedback. I don’t use any of the Facebook post to wall functions as I have my production blog being pulled in by both RSS and Tumblr so my friends already get each post twice so I don’t feel the need to pull it in a third time.

    With that being said, from a user interface stand point the options of the Facebook wall posting have become quite complicated.

    My proposed solution would be to use tooltips for much of the explanation.we could also use jQuery to only show some options if the user selects to post to wall like most of the other options in WBBook. For example unless the user wants to publish to their wall we don’t need to ask for their profileID. Same for Fan PageId. I’m not sure which of these options are grouped or how they should be grouped. I belive all the comment settings should only be shown if the “import comments” button is checked.

    In other news I see you have a Facebook gravatar here at OP but you say that if they use the default e-mail they won’t have a gravatar. Do you think we should set things up so they get the Faceboook icon as the default gravatar or leave it blank?

    Just my thoughts, let me know if you would like me to move forward grouping options and adding the to the tooltips (or if you want to, or if that’s a bad idea) Also thoughts on gravatar.

    Thanks John.

  9. 2.0.0 (and 2.0.1 which I just tagged for release) won’t seem much different if you don’t use the Stream functions (to post to your personal wall or to a Facebook Fan Page).

    What WPBook is doing that you won’t get from Tumblr or RSS is pulling the comments people make on your FB wall in response to a WPBook post and importing those to WordPress comments.

    There are also a number of new options people have been requesting: custom attribution line, and the ability to promote external permalinks rather than internal to FB ones.

    I do realize it is getting complicated, though, and take your point.

    It almost seems like there are two usage patterns for WPBook, one of which involves posting to your FB wall (or Page’s wall), and sending users to the external WordPress blog.

    The other involves the actual FB Application “view” of your blog, which some people love and want to promote, and others don’t care for and want to hide as much as possible.

    I can see a number of groupings: 1) Required, 2) Streaming to wall/page, 3) Inside Facebook View Options.

    In that case, the gravatar, commenting inside FB, and “socialize” options all would be in section 3, which has to do with posts viewed IN the Facebook application.

    One problem is that many WPBook users don’t get the distinction between the Facebook application view of the blog and the “posts” made to their FB Wall or Page – not sure how to make that clearer except in completely redone, longer instructions – maybe even a series of videos.

    ps. On the Gravatar – the default gravatar for comments imported from Facebook is a blank profile with an ‘f’ overlay – not unique to each user or specific to each blog. The setting allows the user to create their own “generic facebook user” gravatar to use on those comments.

  10. No – I’m still using the old REST API. Converting to the new PHP Client and new API is on the “todo” list but that’s becoming a long list. ;)

    I did release a 2.0.1 which now captures the users non-expiring session key for offline_access and is importing comments from the wall.

  11. Thanks John,

    I’m using WPBook 2.0.1 for my FB wall. I want to show excepts and thumbnail from my WP blog post on wall as Facebook Notes does. How can I config it?

    Thank you once againt,

Comments are closed.