
Edit 01/07/09: I’m no longer involved with the majority of development of WPBook. There’s a great team currently working on it, and we have a Google group where questions/problems can be fielded by active community members.
My foray into WordPress development is WPBook, an easy-to-install and fully customizable plugin that creates a Facebook application mirroring the content of your self-hosted blog. I want to briefly discuss several things, including how I created it, what it can do now, and where I see this going in the future.
What is WPBook
WPBook is a WordPress plugin that mirrors the content of your blog in the Facebook canvas, visible within their site’s template. Users of the social networking site can then view and/or add the application. Right now there are two blogs running the plugin that you can check out: my application called Finding America, and Jeremy Boggs’ History 120 application. I’ve taken a screen capture of the very simple template hack I performed to control the display of the blog on Facebook’s site. Also, notice how a quick-link to my blog is listed under Applications on the left side of the screen.

Developing WPBook
This is the first WordPress plugin I’ve created, but I think it’s worth saying how simple this was to create. There were several hurdles; including automatically mirroring the content on a static page with a separate template, but in the end the solution I came up with is very straightforward. After discovering Facebook’s update_option and wp_insert_post functions, I saved myself many lines of code by stripping out SQL statements and unnecessary logic. I’d love feedback from WP plugin developers on how to make this better.
Why a Facebook Application
I’ve noticed two trends in higher education: 1) professors are using and exploring blogs as a medium for communicating with students 2) given the vast reach of social networking sites, there has been increased interest in educational application for Facebook. Several months ago I blogged about libraries on Facebook, and since then there has continued to be an increase of these apps. My hope is that this plugin can help to move both of those closer together, and also engage students in new ways with additional features.
The Future of WPBook
The current version of WPBook displays the content of your blog in the Facebook, and makes it easy to access for your readers on Facebook. Future versions of WPBook will take advantage of the social features of Facebook and its development platform. While I haven’t nailed down the specifics, I hope to provide the option of sending notifications to users of your app once you’ve posted a new message, and also allow users to comment directly via their Facebook ID.
Download and Install WPBook
I have uploaded version .4, which you can download now. Included in that zipped file is a readme with four easy steps to set up your own. Note that one of the steps requires for you to obtain an application key and secret key from Facebook’s developer application; if this is unclear in the readme, I’ll update it with more details. WPBook is definitely in beta, but based upon my testing with several installations it’s stable. If you have any questions or suggestions, leave a comment on this post.
Happy blogging
Edit 10/12/07: I’ve added WPBook to WordPress’ plugin directory. Check there for updates as I continue to improve it. http://wordpress.org/extend/plugins/wpbook/
Hey Dave,
Thanks for this. I’m having trouble getting the install to work proper. I’m getting this error:
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in [my real directory] on line 37
Hey Jeff, what version of WordPress are you running? Still though, that’s an odd error to get. Did you manually edit the file at all? I’ll double check the code for you.
I did installed and fill in both API and secret keys with no error, but the /wpbook/ is empty, any clue?
Hi elBarto, it’s likely that you didn’t supply a callback URL when obtaining your application keys on Facebook. Give the full url to the wpbook directory, http://www.yourblog.com/wpbook/ and it should work. The current version of WPBook that I have under version control requires date and name-based permalinks; that will be optional in the near future after I make some further revisions. I hope that helps!
Hey Dave,
I am having problems with my installation. I ended up having to install simplexml44-0_4_4 in the wpbook/php4client/ folder as this seemed to be the initial problem.
The problem I am faced with now is that if I go to http://www.zimbabweansonline.com/123/wpbook/ I am automatically taken to the facebook login page which is what I presume should happen but when in facebook and I try to go the application I get this message:
Fatal error: Call to undefined function: add_action() in /home/sites/zimbabweansonline.com/public_html/123/wp-content/plugins/wpbook/wpbook.php on line 139.
Not sure what I have done wrong and given that I know very little about php any help would be greatly appreciated.
P.S. as I mentioned earlier I have next to know knowledge in php, however I think the idea of your application is awesome. I was wondering if I could help you develop it (perhaps I can help by writing clearer installation instructions etc… Let me know if you are looking for help)
For whatever reason when I put the key and secret inside the wordpress admin:
/wp-admin/options-general.php?page=wpbook.php
They are not saving to the database.
Ok I got it working after I manually changed the api_key and secret in the template.php file.
If you’re running php5 like I am you’ll need to also change line 4 in template.php to:
include_once 'client/facebook.php';
managed so sort it out… I was linking back to the plugin instead of
http://www.myblog.com/wpbook/
If you are using php4 like I am you may need to download
simplexml44-0_4_4 ( http://downloads.sourceforge.net/ister4framework/simplexml44-0_4_4.tar.gz) and put it in the php4client folder
Awesome application… I look forward to all the future developments!
Leo and Hon, thanks!
I assumed the php4 facebook library would work fine in php5 — I’ll add a something to the codebase to automatically check that. Glad to see you like the plugin.
Hey Dave,
I am guessing the reason for your new layout on this site
is because you want it to display in Facebook using FBML instead of using
an iframe?!
If this is the case is this theme available?
Hey Leo – this WordPress Theme is a work-in-progress for the future design of my personal blog. You bring up a good point though, which is that I should make a theme that works well in an iframe embedded in the Facebook Canvas. I’ll add that to my to-do list.
Thanks Dave for the Facebook Application Plugin.
Any chance of developing MySpace Application Plugin?
At this time, there are several other developers who have taken a much more active role in WPBook. I have no plans to develop a MySpace application plugin at this time, but it’s possible there may be interest on our developer group. I’d try asking there:
http://groups.google.com/group/scholarpress-dev
Cheers,
Dave
Thanks I will join the group and see what I can contribute.
i read the readme.txt and second instalition: “Copy the wp-facebook.php directory into your themes folder, normally located in /wp-content/themes/”
where is the wp-facebook.php :S
I must be missing something. I’m brand new to Facebook, so that may be the problem. I followed all the steps in your instructions. I got to the end of the steps and…
Now what? How do I get anything to actually show up on my Facebook Profile?
One thing I may be missing: I see absolutely no reference anywhere in the developer settings to a “sidebar URL”.
I also see dozens of other fields and no instructions to do anything with them, so I ignored them.
OK, I have a working App at:
http://apps.facebook.com/dobovedo/
But there’s a number of things wrong with it. The links to the stories can’t be clicked or the app enters into a nested loop problem. That could have something to do with a conflicting plugin.
And i get a page full of errors when I try to invite friends to use it.
Dave, I love this plugin but I am having a bit of a hard time with it. Everything seems to work, the canvas URL display and updates perfectly, I can invite friends to use the App. However, on my profile page (or if I move it to the Boxes page), all that keeps showing up is “No content to display” message instead of the five most recent posts. What am I doing wrong? Thanks!
I seem to be have 2 issues,
1. same as mentioned before, “add to Profile” – No content to display.
2. Add Comments – I get a white page on my blog when it hits this page: /wp-facebook/fb-comments-post.php?auth_token
Im on WP2.7
thanks for any help
Thank you Bluealien, Lidija, and Dobovedo for your recent questions and interest in WPBook. The plugin is under active development, however I no longer field WPBook questions on my personal blog. In addition, there are now two new developers who have greatly enhanced WPBook from the original code I’ve written.
Please refer any questions you may have to our google group:
http://groups.google.com/group/scholarpress-dev
Best,
Dave