Steve's Ramblings

  • Home
  • About
  • LastFM Widgets
  • Post By Mail
  • Site Search
  • Wordbooker
Witterings from the Site owner

← The Cast List of White Christmas
The importance of testing →

WordPress and Facebook Integration

January 2nd, 2010 by Steve and tagged facebook, plugin, wordpress, WPMU


I’d been using the Wordbook app for quite a bit but I’d always found that it lacked some features that I liked. I’ve now added these functions and got it doing things how I’d like.

So rather than keep cluttering up the original wordbook application page I’ve forked by code off totally.

I created a new Facebook application called Wordbooker and then created a new plugin called Wordbooker in the WordPress Extensions site.

Upgrading from the Forked Version.

As this is basically a new application its a bit messy as doing a normal removal of the old forked version will remove any record of posts/comments made with the forked version.

If you wish to retain that history then you need to back up the existing wordbook_postcomments table BEFORE you remove the forked version of wordbook.

Go into the options page for Wordbook and reset the configuration for wordbook

From the plugins page de-activate the wordbook plugin.

Delete the wordbook directory from wp-content/plugins

Upload the wordbooker directory into the wp-content/plugins directory

Go into the Plugins page and enable Wordbooker.

Go to the options page for Wordbooker and  it will ask you to get a login key from Facebook and then ask you to grant two extra permissions needed by Wordbooker – these allow Wordbooker to publish to your wall and also to fetch comments from it.

Click on the Save Configuration button.

You can then set up the various options on the option screen:

Wordbooker Options page

Wordbooker Options page

** Multiple Facebook account / WordPress account support **

If you as the blog owner only want it so that WP posts go to your FB account then go into the Options screen and set the default account to be yours, and that should be it, any person using a different WP account to post to your blog will publish those stories to your FB account.

But what if you’ve got a Family WB where different people would like to post to WP and to their OWN FB accounts. Simply get each of them to login to WP as themselves and configure WB as if they were the only user. Then when all of them have done this go back in as yourself and set the Default account to be you.

On the Edit Post page there is a WordBook Options block which includes a drop down list of the blog you wish to post to, if you want to post to your default blog then you don’t need to touch this but if someone wants to post that post to their FB account all they need to do is pick their name from the drop down list before they post.

** Length of Extract **
This allows you to change the length of the extract posted to Facebook. The minimum value is 200 and the maximum is 400 (at the moment) with the default being 256 characters. The extract will be trimmed to the nearest full word BELOW this value.

** Default Publish Post to Facebook **

This allows you to choose if posts should automatically be posted to Facebook. This option can be overridden from the Edit Post page

** Post Attribute **

This allows you to change the attribute line when posts are sent to Facebook. By default this is set to “Posted a new post on their blog”. This option can be overridden from the Edit Post page.

** Republish Post if edited more than x days ago **

This allows you to control how long it should be before Wordbook considers an edited post to be a “new” post and re-publishes it to Facebook.

** Override Re-Publication window  **

This allows to to force all edits to be reposted to Facebook ignoring the republish window. This option can be overridden from the Edit Post page.

** Update Facebook Status **
If this option is checked then the title of your blog post and its permalink will be posted to your status, along with the text specified here. This can be overridden from the Edit Post page. NOTE: If this option is Selected then your status is ALWAYS updated, even if you choose NOT to publish your post to Facebook.

** Import Comments from Facebook for Wordbook Posts  **

This version of Wordbook supports the importing of comments made on Facebook back into your WordPress blog. This allows you to set the default behaviour. This option can be overridden from the Edit Post page

** Auto Approve imported comments **

If you trust your friends on Facebook then you’re probably quite happy for their comments to automatically get posted as comments on your WordPress blog. If this option is not set then any imported comments are held in the moderation queue.

Once you’ve got the options set how you want then save them.

If you exported the wordbook_postcomments table before upgrading then you can now import it back into the database.

There may be times when you you are posting a blog entry and you’d like to do something differently, like NOT publish a post, or change your choice on what you do with comment. So on the Add New and Edit posts page you should now find a Wordbooker Options Override block where you can override several defaults:

Wordbooker Post options

Wordbooker Post options

If you are the administrator of a Facebook Fan page then you’ll also be given the option of posting to that page instead of posting to your own wall. At the moment there is a bug in the API which means that posts made to Fan Pages are shown as YOU posting on the Fan Page wall – rather than it looking like the Fan Page has posted the post directly.

PROBLEMS

If you’ve got problems its probably best to post them on the Wordbooker Page on Facebook where people can create new threads for each bug/problem and people can easily see if any fixes have been made

  • Share this:
  • Digg
  • Reddit
  • Print
  • StumbleUpon
  • Press This
  • Email

Category Computing, Wordbooker |



117 Responses to “ WordPress and Facebook Integration ”

1 2 3 Next »
  1.    Gareth Says:
    January 2nd, 2010 at 6:53 pm

    Hi Steve

    Your plugin looks interesting. I have a question re advertising opportunites, but couldn’t find any contact info. Please can you email me.

    Thanks
    Gareth

  2.    Steve Says:
    January 2nd, 2010 at 6:59 pm

    What do you mean advertising opportunities?

  3.    wwwindi Says:
    January 2nd, 2010 at 9:34 pm

    Hi -
    This looks great.
    Question: How many images are included in the facebook excerpt of wordpress post?
    Also, does this produce a duplicate post that would interfere with search rating?

    Thank you for your work!

  4.    Steve Says:
    January 2nd, 2010 at 9:36 pm

    I think Facebook supports 4 or 5 images max. They keep changing their minds.

  5.    wwwindi Says:
    January 2nd, 2010 at 9:43 pm

    how about the duplicate post issue – is that something to be concerned about?

  6.    Steve Says:
    January 2nd, 2010 at 9:46 pm

    What duplicate post? All this basically does is share an extract of your blog post on your facebook profile. So all its doing is directing people from FB who follow your wall that you’ve posted a blog entry.

  7.    Nicolette Bethel Says:
    January 3rd, 2010 at 3:37 pm

    Great idea, but not working on my blog. Returns the following error:

    Parse error: syntax error, unexpected ‘{‘ in /hermes/bosweb/web254/b2541/sl.nicobeth/public_html/blogworld/wp-content/plugins/wordbooker/wordbooker.php on line 143

    Does the blog have to be running on a particular version of PHP? My host is still using version 4, which is causing some plugin issues.

    I love the idea and would like to get the thing working — I do a lot of work on FB and WP and would LOVE for them to talk to one another.

    http://wordpress.org/extend/plugins/wordbooker/

  8.    Steve Says:
    January 3rd, 2010 at 3:54 pm

    Nicolette, unfortunately it can’t be run against PHP4 – Facebook no longer support PHP4 in their API libraries and I’ve been running on PHP5 for well over a year now.

    Support for PHP 4 has been discontinued since 2007-12-31 according to the PHP website so really your host needs to kicked into doing something.

    Sorry I can’t help further.

    Steve

  9.    Nicolette Bethel Says:
    January 3rd, 2010 at 5:03 pm

    Thought that might be the case.

    Major bummer.

  10.    Steve Says:
    January 3rd, 2010 at 5:12 pm

    I think that WP will soon be moving to PHP5 only, and it seems that they’ve done a lot of stuff to keep it running on PHP4but would like people to move to PHP5

    http://wordpress.org/support/topic/316394?replies=14

  11.    paul Says:
    January 3rd, 2010 at 6:44 pm

    Hi Stephen,
    happy new year.
    i am trying to config ‘wordbooker’ by getting the code from facebook. every time I try (after I log in) I get the “oops, Facebook was not able to generate the code, try back later”
    any suggestions?

  12.    Steve Says:
    January 3rd, 2010 at 6:48 pm

    There is something going on with FB right now – I’m unable to make any changes to my app page. Is the error you are getting on the FB page (the one that opens in a new window when you click on the icon on the Wordbooker options page)?

  13.    paul Says:
    January 3rd, 2010 at 8:37 pm

    Yes ’tis indeed.

  14.    Phil v. Sassen Says:
    January 3rd, 2010 at 9:40 pm

    I am not able to obtain the one-time code.

    Best regards, Phil

  15.    Steve Says:
    January 3rd, 2010 at 9:48 pm

    Thats a FB problem – nothing to do with my code. Whole parts of the FB back end don’t seem to be behaving properly at the moment.

  16.    Phil v. Sassen Says:
    January 3rd, 2010 at 9:50 pm

    THX for the “speedy” answer!

  17.    Steve Says:
    January 3rd, 2010 at 11:00 pm

    It might work now – the application profile has now re-appeared

  18.    Phil v. Sassen Says:
    January 4th, 2010 at 12:07 am

    It works!

  19.    Ng Sze Hin Says:
    January 4th, 2010 at 11:22 am

    Hello, great apps! thanks for the work!

    Few questions. 1. I have tried to import posts with Chinese (Traditional) text, and in that case it would only grab the first 10 or so characters (even if I say 200). I then tested it by replacing english test on the same post and re-post, and it grab more text. Anything I could do?

    2. I have Chinese text and then a Youtube video on the post, and then some jpg. The plugin didn’t grab the photo in the first go (unless I press “see more”). But if I repost with the jpg on top, the picture is shown. Anything I could do?

    Thanks!!

  20.    Ng Sze Hin Says:
    January 4th, 2010 at 11:26 am

    Oh, question 3,

    If I post more than 1 post and feed to Facebook in a row, the Live Feed would only show the latest one? Is that a restriction of Facebook stopping outsiders feed? (coz I could manually posts multiple links of my blog myself and the Live feed would show them all!)

  21.    Steve Says:
    January 4th, 2010 at 11:36 am

    1) I’m not sure – I’ve no idea how mysql and php (or indeed the Facebook API) handles traditional Chinese. Does the small bit of Chinese end with a set of dots? If it does then its my code that trims the post down causing problems.

    2) Not sure about this one, I haven’t coded for emebedded video as I dont think the FB API handles it, but its obviously doing something odd. By default FB only displays one image now until you click on “see more”.

    3) What you will probably find is that FB rolls them up into a block and you’ll see the latest post with a “See x similar posts” underneath it. That’s what I get when I’m testing it.

  22.    ngszehin Says:
    January 4th, 2010 at 2:14 pm

    Steve:

    1. Yes, with 3 dots at the tail. And other applications (including the original Facebook URL import) does show much more chinese text in the box.

    2. And, I don’t want to see the video. I would rather the software could jump and grab the first photo available and make it as thumbnail of the post.

    3. You mean under the “read entire article” link? no, I don’t see the ““See x similar posts” line there in the Live Feed. (but I do see all the posts separately one by one in my own profile.)

    Cheers,

  23.    Steve Says:
    January 4th, 2010 at 2:27 pm

    OK – its something to do with my code then.

    I do :

    $excerpt=current(explode(“\r”, wordwrap($excerpt, $maxlength, “\r”))).” …”;

    So at a guess there are some “\r” buried in the code somewhere, or something that is tripping it up. I’ll have to look into that.

    Are you using GBK-encoding by any chance?

    2) I’ll have to dig into it and see if I can get it to do it for me.

    3) OK, that’s odd because when I post to my test account they get rolled up with a “similar post” message when they appear on the live feed of my normal account.

  24.    Steve Says:
    January 4th, 2010 at 2:42 pm

    1) OK I think I’ve worked out a fix for the string splitting.

    2) How are you embedding the Youtube video?

    3) Multiple posts from by test blog show up in my real account live feed with no problems.

  25.    paul Says:
    January 4th, 2010 at 2:56 pm

    Hi steve,
    ran into a permission problem with FB first time out, error =200. any suggestions?

  26.    Steve Says:
    January 4th, 2010 at 3:02 pm

    200 is a permissions error. Can you see if wordbooker has been added to your list of application with extended permissions inside Facebook.

    Where did you get the 200 error? Was it during set up? Did the options page ask you to grant two additional permissions?

  27.    paul Says:
    January 4th, 2010 at 3:09 pm

    i received the error with my first post using the plugin. i did get the code last evening from FB and did the verification, and I received the “status” back along with my profile pic. should I find the app on FB and add it to my list of apps?

  28.    paul Says:
    January 4th, 2010 at 3:16 pm

    sorry for the addendum,
    FB says that Wordbooker is ‘under construction’

  29.    Steve Says:
    January 4th, 2010 at 3:22 pm

    Hmm thats odd

    http://www.facebook.com/apps/application.php?id=254577506873

    is its URL and its working fine for other people apparently.

    Do you get your current FB status and picture when you go to the options page?

    Can you remove it from your extended apps on your profile and then go into the options screen inside WordPress and do the “reset” and go through the authorisation process. There were problems with the app profile last night which might have broken things.

  30.    paul Says:
    January 4th, 2010 at 3:26 pm

    I do get my profile pic and recent status on the options page. I will go ahead and reset everything. and give you an update here rather than FB

  31.    paul Says:
    January 4th, 2010 at 3:32 pm

    Bingo. I guess last nite I was just a wee bit behind the updates.
    many thanx steve.

  32.    Steve Says:
    January 4th, 2010 at 3:34 pm

    OK – so its got the read privs, just not the write ones.

    You could just try using the following two urls:

    http://www.facebook.com/authorize.php?v=1.0&api_key=0cbf13c858237f5d74ef0c32a4db11fd&ext_perm=publish_stream

    http://www.facebook.com/authorize.php?v=1.0&api_key=0cbf13c858237f5d74ef0c32a4db11fd&ext_perm=read_stream

  33.    paul Says:
    January 4th, 2010 at 3:37 pm

    done deal.
    thanx again. now go have a sandwich

  34.    Ng Sze Hin Says:
    January 5th, 2010 at 6:04 am

    Steve:

    my characters should be in unicode UTF-8.

    If you have any updates, I could help to test it again.

    Cheers,

  35.    ngszehin Says:
    January 5th, 2010 at 7:38 pm

    thanks. but it seems the effect is the same.

    http://www.facebook.com/leonard.s.ng?ref=profile

  36.    Steve Says:
    January 5th, 2010 at 8:02 pm

    OK, I’ve looked at the source of your page.

    Can you edit the wordbooker.php file

    Find the wordbook_post_excerpt function which should look like this:

    function wordbook_post_excerpt($content, $maxlength) {
    $excerpt = apply_filters(‘the_excerpt’, $content);
    if (function_exists(‘strip_shortcodes’)) {
    $excerpt = strip_shortcodes($excerpt);
    }
    #$excerpt = strip_tags($excerpt,”);
    $excerpt = strip_tags($excerpt);
    if (strlen($excerpt) > $maxlength) {
    ## Changed to stop Traditional Chinese being broken at the wrong place. Hopefully no-one will ever use this string.
    $excerpt=current(explode(“SJA26666AJS”, wordwrap($excerpt, $maxlength, “SJA26666AJS”))).” …”;
    }
    return $excerpt;
    }

    and change it to look like :

    function wordbook_post_excerpt($content, $maxlength) {
    $excerpt = apply_filters(‘the_excerpt’, $content);
    if (function_exists(‘strip_shortcodes’)) {
    $excerpt = strip_shortcodes($excerpt);
    }
    #$excerpt = strip_tags($excerpt,”);
    $excerpt = strip_tags($excerpt);
    var_dump($excerpt);
    if (strlen($excerpt) > $maxlength) {
    ## Changed to stop Traditional Chinese being broken at the wrong place. Hopefully no-one will ever use this string.
    $excerpt=current(explode(“SJA26666AJS”, wordwrap($excerpt, $maxlength, “SJA26666AJS”))).” …”;
    }
    return $excerpt;
    }

    Then save it and do another test post and it should dump the excerpt onto the web browser.

    Does it just contain your text or is there a large chunk of Javascript at the start.

  37.    ngszehin Says:
    January 5th, 2010 at 8:22 pm

    it says

    “Parse error: syntax error, unexpected T_STRING in /home/ngszehin/www/www/wp-content/plugins/wordbooker/wordbooker.php on line 1256″

    when I attempted to save the php.

  38.    ngszehin Says:
    January 5th, 2010 at 8:52 pm

    Gees!!! I guess it works!

    It didn’t work with the posts that I have tested before, because I guess Facebook remembers it. However, I have tried (and you could see that in my profile now) another old post, and it works!

    Thanks so much! And hope you enjoy the process yourself too!

  39.    Steve Says:
    January 5th, 2010 at 8:56 pm

    Thats great – it was actually down the way I was processing the post data, so anyone who had the plugin that puts the “Welcome Facebook” block into your posts would have had the same problem.

    If you go onto Facebook and delete the posts you can then go back into your blog, edit the old posts and just select the “Force Re-Publish Post to Facebook on Edit (overrides republish window)” option on the Wordbooker options block on the Edit Post Page and then click Update Post and it will republish them to Facebook.

  40.    ngszehin Says:
    January 5th, 2010 at 9:03 pm

    and by the way, I would like to ask if you know there is any plugin (or otherwise you could write one) that could generate a list or index of posts in my selected category, with a thumbnail that is fetched from the external linked (liked how Facebook grab my image when we post the link there) (I hosted my photos in Fotki.com instead of my local host of WP)?

    The purpose is, I would like to build a table of contents with thumbnails of all the posts which has the photos of my sons (currently under the same category). Currently I am using a simple plugin called “List Category posts” (http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/) to make the table of content pages (http://ngszehin.net/entertainment/). I also have that for the photos posts (http://ngszehin.net/baby/) but I would like this to be in thumbnails instead of words. Could you think of the easiest method for this?

    Cheers,

  41.    Steve Says:
    January 5th, 2010 at 9:21 pm

    Have you tried asking over on the WordPress support forums http://wordpress.org/support/

  42.    ngszehin Says:
    January 5th, 2010 at 9:30 pm

    I have tried, but no answer. So nothing pops up from your mind related to this? Or are you able to write a simple code to do this? hee hee….

  43.    Steve Says:
    January 5th, 2010 at 9:40 pm

    Nothing pops up in my mind. I’m a bit busy with wordbooker and other stuff that is internal to my blog (integration with my brothers web site).

  44.    ngszehin Says:
    January 5th, 2010 at 9:59 pm

    thanks anyway! And good work with the Wordbooker. A really nice integration indeed!

  45.    Steve Says:
    January 5th, 2010 at 10:27 pm

    Thanks, and if you want to suggest more features then the discussion tab on the app profile is the best place to do it.

  46.    DanGarion Says:
    January 7th, 2010 at 11:36 pm

    Awesome plugin, I just switched to this from Wordbook. Can’t wait for the Fan page part to work correctly!

  47.    Steve Says:
    January 8th, 2010 at 8:15 am

    As soon as the bug ( http://bugs.developers.facebook.com/show_bug.cgi?id=8184 ) is fixed I’ll test it and release a fix.

  48.    ngszehin Says:
    January 9th, 2010 at 2:37 am

    hi mate, it was working just fine for a few days now. So happy. Just 2 questions.

    1. Should I expect the Wordbooker to work for my scheduled future posts? Coz I tried and didn’t work, but not sure if I have the correct setting.

    2. If there is a comment on Facebook, then the comment is fed to the blog with no problem. But if the comment is left on the blog, then firstly the comment would be fed to facebook first, but then it would be fed back to the blog again. So I end up having a double for that comment. Is this normal?

  49.    Steve Says:
    January 9th, 2010 at 9:52 am

    1) I’d not coded it for future made posts – but I can look into it and see how difficult it would be to add it in.

    2) Its a bug which will be fixed in 1.5. There is a quick fix for it which I documented here : http://www.facebook.com/apps/application.php?v=app_2373072738&ref=nf&id=254577506873#/topic.php?uid=254577506873&topic=11923

  50.    ginger Says:
    January 11th, 2010 at 3:23 am

    Thank you, Steve! I’m not a very technical person, but I was able to install and run this successfully without a hitch. This is really lovely!

1 2 3 Next »
  • Facebook Status


     FB photo for Stephen Atty


    Stephen Atty : OK - where's the Lamba key on my keyboard....
    (Sat Jan 21, 4:49 pm).

  •  

  • The Old Stuff

    • October 2010
    • July 2010
    • May 2010
    • April 2010
    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • October 2009
    • September 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • December 2007
    • November 2007
    • October 2007
    • September 2007
    • August 2007
    • July 2007
    • June 2007
    • May 2007
    • April 2007
    • March 2007
    • February 2007
    • December 2006
    • October 2006
    • September 2006
    • August 2006
    • July 2006
    • December 2005
    • November 2005
    • August 2005
    • February 2005
    • January 2005
    • December 2004
  • Site Wide Tags


    3G 93 95 accident accounts Add new tag alcohol allergy advice alone alternator america android animal anniversary apache augusta autherley bank basketball beer Beeston benefits birmingham birthday blogging blogs boat boating Bob Geldof Boscastle boston brakes Braunston brewood BSS Bude builders C cable calendar camsigh canalplan canalplan AC car crash car park cars Cast List casualty Cats Challenger chavs cheese cheltenham Chester christian louboutin for sale christian louboutin on sale christian louboutin sale online Christmas cinco de mayo clearsilver coast code coding cold Computer Computing cooker CPRS crackers curry customer service dead depression diet diy dns Download dowód e-commerce easter eli stone elvis email enhancement extension facebook fashion jewelry favourites fish floods food forums Fraud fridge funding g1 gailey garage garden gas GCHQ General Options geospatial gloucester gnosall gold cup goldstone Goodies google Googlemaps granny buttons graph API grub street guinness hackers hallowell Heathrow holiday holidays home home mooring hoover hotel Importing integration intercontinental internet Internet Explorer irish Javascript jen jewellery Jill Joke json kathy kennebunk kestrel kitchen korea ladykat Last.FM latitude lawn leeching lighthouses linux ll bean lonely longitude lunch maine malvern manage routes maps market drayton maths mexican microsoft midges mintball mobile mooring mortgage MOT moving mozart MP Music mystery na Nantwich national hunt netscape new domain new features new server nhs norbury npower ogunquit painting paprika party penkridge petition photos php phpbb pickle plugin Plugins poke in the eye police portland post by email Pożyczka pringles programming pub night

    Donate

    If you've found anything useful on here and want to say thanks then please feel free:



    WPMUDEV

    WordPress MU, WPMU and BuddyPress plugins, themes and support at WPMU DEV

    Snapshots

    Enhanced with Snapshots
  •  


© 2012 Steve's Ramblings using Dignity theme by themebox

RSS Entries and RSS Comments.

Provided by WPMU DEV -The WordPress Experts
Hosted by Canalplan Blogs


Server uptime: 66 day(s), 22 hour(s) and 21 minute(s) | Server Load: 0.14, 0.19, 0.18

Canalplan Interlinking provided by Canalplan AC Plugin

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.