Feed on
Posts
Comments

Results for wordbook

WordPress and Facebook Part five

Posted November 10th, 2009 by Steve

Well I’ve been hard at work on my forked version of the Wordbook plugin which links your own hosted WordPress Blog with your Facebook account. Oh and it also works with WordPress MU too.

Its now really reached a point where I’m quite happy with it.

So what does it now support?

Multiple Facebook account / WordPress account support

If you have multiple users of your blog the old version wouldn’t post to YOUR Facebook account. It would post to THEIRS, if they had set it up. This version of the plugin now handles multiple WP Accounts. 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 WordPress 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.

Posting using XMLRPC clients

Posts published to your WordPress account using XMLRPC clients will now also publish to Facebook – if the default option of posting to Facebook is set. Posts made via this method will also pick up the default target Facebook account, the default post attribute line, and the Update Status options.


Upgrading from the stock version obtained from the WordPress plugins repository:

* You need to de-activate the old plug in first.
* Then DELETE the wordbook folder from wp-content/plugins and then upload the new version. DON’T just copy the new files up.
* Re-activate the plugin
* Go to the Options page for the plugin and you can set all the new wizzy options. If you want to pull comments from your Facebook account you’ll need to grant the plugin permission to read from your stream. If you don’t grant this permission then you can’t pull comments, and I’ve no idea what my code will do if it tries to do that because I didn’t test it! So you have been warned!

Debugging

The only place I’ve put any real debugging in is in the cron job code because its very hard to actually work out if its working if there are no comments to pull. Debugging for that can be enabled by editing two lines in wordbook_cron.php:

define (’DEBUG’, false); which you change to true

and

$debug_file=’/tmp/wordbook_’.$table_prefix.’debug’; which you may need to change if you want to change the output directory.

So where is it I here you ask?

Right Here:

wordbook1.5

WordPress and Facebook – Part 4

Posted October 28th, 2009 by Steve

Back in August I wrote about the Wordbook plugin for WordPress which basically replicates posts from your own hosted WordPress (or WordPress MU) blog into your Facebook account where they appeared on your wall.

The plugin did something well but it lacked several things that I’d like it to do. So I started adding them. The sidebar widget was the easiest thing to do as that was pretty much self contained and as you can see from this blog its working quite well.

The plugin had a very annoying habit of re-posting a post if you edited after more than a few days and it seemed to publish posts to Facebook when you’d least expect it.

So I rehashed that code and got it all working.

But everything was hard coded. What if I wanted to force it to republish a post to Facebook when I edited it, what if I wanted to automatically republish if editing after 10 days, except that I didn’t want it to do it for a specific post.

That was all the easy stuff.

But what about comments? Wouldn’t it be cool if comments posted on your Facebook copy of the post could be pulled down into your blog as comments to that post. Sure it would be cool, and it wouldn’t be that difficult would it.

WRONG!

The plugin used the Feed.publishUserAction API call. Its a neat little function but it doesn’t return the Post ID for the post you just made into facebook, and you need the Post ID to pull comments back. The obvious answer was to use the stream.publish API call instead. That returns the Post ID and then you can simply get the comments by using Stream.getComments and passing it the post ID in question. To get all of that working I needed to grab the latest version of the API files and I had to recode the way the plugin posts as Stream.Publish uses a different structure for a post.

So once all that was working and I’d coded up a nice options page and put an option block on the Edit/Add Posts page so you can override some defaults (like saying you DON’T want to import comments for a post) all that was left was to code up a comment fetching job and work with WP-CRON to schedule it.

I finished all of that a couple of weeks ago, and I’ve been debugging it since but now I think its probably ready to escape into the wild and if anyone is mad enough to want to test it then Here it is

Some quick notes on Upgrading from the existing Wordbook plugin.

  • You need to de-activate the old plug in first.
  • Then DELETE the wordbook folder from wp-content/plugins and then upload the new version. DONT just copy the new files up.
  • Re-activate the plugin
  • Go to the Options page for the plugin and you can set all the new wizzy options. If you want to pull comments from your Facebook account you’ll need to grant the plugin permission to read from your stream. If you don’t grant this permission then you can’t pull comments, and I’ve no idea what my code will do if it tries to do that because I didn’t test it! So you have been warned!

Debugging.
The only place I’ve put any real debugging in is in the cron job code because its very hard to actually work out if its working if there are no comments to pull. Debugging for that can be enabled by editing two lines in wordbook_cron.php:

define (‘DEBUG’, false); which you change to true
and
$debug_file=’/tmp/wordbook_’.$table_prefix.’debug’; which you may need to change if you want to change the output directory.

Caveats

You knew there would be some didn’t you!

I developed this on WordPress MU which is the MultiUser version of WordPress. I developed it  using 2.8.4a which is the same as 2.8.4 in standard WordPress. I HAVE NOT tested it on older versions so I cannot guarantee things like the draggable box on the Edit/Add Page will work if you are not on V2.8.4

As I’ve now sort of released this plugin I’ve created a page where I’ll log any changes to it in future. So if you want to keep upto date then you’ll need to check my Wordbook Page

WordPress and Facebook – Part 3

Posted August 11th, 2009 by Steve

I posted previously about the Wordbook plugin for WordPress which links your WordPress blog to your Facebook account. I’d down loaded it and installed it and it worked quite well.

Then I wrote about how it reposted WordPress posts if you edited them. It only did this if they were more than a day old which seemed a bit odd. So I changed the code to stop it doing that.

Also I wanted to have a link back from my blog to my Facebook account so I wrote a very minimal sidebar widget to link the two together.

This morning I’ve been recoding the widget so that its more flexible

So my widget now supports:

  • Widget title can be changed by the user, it’s no longer fixed as Facebook Status
  • User can override the name displayed – so rather than using the name on Facebook you can display a different one. On Facebook my name is shown as Stephen, but if I want on my widget that could be replaced by “Steve” or Wombat, or anything!
  • Different Date Formats. You can now select from a choice of date formats including a Facebook style textual one.

I might add some more formatting options such as changing the style of the status (currently fixed as italic).

To make sure that the widget and the plugin don’t get separated I’d coded my widget into the end of the plugin code and some people on the Wordbook group on Facebook have cut and pasted in to their copies of the plugin and it all seems to work.

But now my widget code is up to 179 or so lines and its getting a bit much to ask people to cut and paste it into their code. So I guess once I’ve got it tidied up a bit I’ll need to contact the developers of the plugin and get my code merged into the code base over on the WordPress plugins site.

Or if you want to try it now then follow these easy steps:

  1. Download the widget code :wb_widget.php
  2. Save the file into the wordbook directory under your plugins folder. Ensure you save/rename the file as wb_widget.php
  3. Edit the main wordbook.php file and add the following line immediately preceding the closing ?> tag at the end of the file: include(“wb_widget.php”);

This also means that when I add features to the widget you just need to grab the latest version from here.

WordPress and FaceBook – Part 2

Posted August 8th, 2009 by Steve

I got a bit bored so I did some hacking around with the code for the WordBook plugin.

It seemed to post to Facebook every time you did anything with a WordPress post such as editing, which isn’t really what you want it to do, so I went in and recoded the logic so that it only publishes to FaceBook on certain activities.

So now all I really need to do is test to see if it works properly!

So if you see some rather odd posts appearing and disappearing then that’s just me!

Server uptime: 80 day(s), 21 hour(s) and 34 minute(s) | Server Load: 0.02, 0.06, 0.04