Embed Facebook Fan Page Photo Albums In WordPress

January 8, 2010

It is a great idea to have a Facebook fan page for your company, club or organization.

This is a minor hack of the Fotobook plugin (Version 3.1.8) for WordPress by Aaron Harp. Fotobook is originally meant to apply your personal photo albums into WordPress, but we’re going to make one small code tweak to instead pull the albums from the fan page that we administer.

After installing the plugin, go ahead and activate it and grant the permissions to your Facebook account.

Next, visit your Facebook fan page, and click into an album so you’re viewing all photos in one particular album. In the address bar you’ll see a &id=123123123. Copy that ID number.

In the plugin directory open the fotobook.php file and head down to line 243 and look for this code.

$uid = $session['uid'];

Swap that code for this

//$uid = $session['uid'];
$uid = 123123123;

With the 123123123 being the ID code for your fan page.

If you have a custom URL set for your fan page you might notice that the album photos are not showing. To correct that move down around line 809 in fotobook.php and look for:

if(!is_numeric($id)) return false;

And code it out of use by adding // in front so that it now looks like

//if(!is_numeric($id)) return false;

Back in the plugin administration page, go ahead and import your albums. And you should be good to go!

With a thanks to B. Thibault in the forums at the Fotobook Application Page.

Tags: , , ,

Was this Post helpful? Please consider a small contribution.

My Amazon.com Wish List
Pypal Tip


45 Responses

Comments

  1. Were you ever able to figure out how to cause fotobook to pull in the album profile image? Your technique worked great except for that. I just basically get a missing image icon next to the album description

  2. I actually haven’t had a problem with the album profile image loading. I’m not sure what could be going wrong there.

  3. Hmmmm, this is what I’m running into:
    http://revivaloutreach.net/blog/photos/

    I figured out how to remove that broken image completely from the page (though haven’t on this page) but would prefer to have a image there.

    Odd

  4. Strange. You could try to completely remove the plugin and disassociate it with your FB account, and start over. That’s all that I can think of, since this approach is a bit buggy. I’ve had to start over in that same manner before, to get it to work properly.

  5. Hmmm. I’ll give it a go. Thanks for your help though in laying out the process to begin with. It was easy to get going

  6. Great hack, thanks!

  7. I’ve found the issue with album photos not showing, and have updated the post.

    You’ll need to comment out if(!is_numeric($id)) return false; around line 809 in fotobook.php

  8. Fantastic!
    Great job, you’ve got some skills!

  9. Fotobook looked great until we bumped into the inability of importing from fan pages.
    This is just what we were looking for, thanks!

  10. awesome hack – always having trouble with utilities that actually work with FB pages. Thanks for this one.

  11. Great hack, but sorry – doesn’t work for me. I always get message: „There are no photos.“ I don’t have custom URL. Any advice? Thank you.

  12. Great hack works for me

  13. This was exactly what I was looking for, does not seem to work for me straight away. I applied the 2 small changes, but get a

    Fotobook encountered an error while retrieving your photos. [Error #601]

    when clicking the “Get Albums” button.

    I looked up error 601, it means Error “while parsing FQL statement”. Any ideas what I might be missing here?

  14. Strange, I’ve not heard of FQL. It may have to do with facebook. Did you try to repeat the install and import process?

  15. Well written post. Keep up the excellent job you’re doing.

  16. hi,

    I set up the Fotobook plugin, following the instructions here, and it worked fine last week, but for whatever reason it doesn’t retrive the Fan Photos anymore… any idea?

    ths in advance!

    -oriol-

  17. Hi oriol, I have the same problem. I have configured plugin to get albums from face fun page. That has worked perfect since last week. I think that the problem is in facebook API which doesnt allow to get albums from funpage. If you have any idea please contact me.
    Regards!

  18. The plugin is still working where I have it used. Have you recently created a custom URL (username) for your fanpage? If so, you’ll need to see the last bit of the tutorial.

  19. this fix it!!! thx :D

  20. This was working fine, until I updated to the latest version of fotobook

    Fatal error: Uncaught exception \'FB_FacebookRestClientException\' with message \'A session key is required for calling this method\' in wp-content/plugins/fotobook/facebook-platform/facebookapi_php5_restlib.php:3003 Stack trace: #0 wp-content/plugins/fotobook/facebook-platform/facebookapi_php5_restlib.php(1608): FB_FacebookRestClient->call_method(\'facebook.photos...\', Array) #1 wp-content/plugins/fotobook/fotobook.php(259): FB_FacebookRestClient->photos_getAlbums(71385461631, NULL) #2 wp-content/plugins/fotobook/fotobook.php(665): FacebookAPI->update_albums() #3 /wp-includes/plugin.php(339): fb_ajax_handler(\'\') #4 /wp-admin/admin-ajax.php(1428): do_action(\'fb_ajax_handler\', Array) #5 {main} thrown in wp-content/plugins/fotobook/facebook-platform/facebookapi_php5_restlib.php on line 3003

    Any ideas?

  21. I’ve also received the same error. It seems to be causing some sort of error on the Ajax calls. I’d suggest rolling fotobook back to version 3.1.8.

  22. word.

  23. I noticed the same problem after I updated the plugin, then I came here & followed the suggested rollback.

    But after rolling back to 3.1.8, the Fan album is not retrieved. I did the last part of the tutorial above where if(!is_numeric($id)) is being coded out.

    Any idea what else I can do or where I could have gone wrong?

  24. a. foushee

    May 24th, 2010

    I have been able to get it to display multiple albums in a fan page, although now one album is not displaying photos. I’m hoping to find a few suggestions.

    See: http://halconvineyards.com/c/photos/

    I tried this and it seemed to work the 1st time:

    1) install old version 3.18
    2) change id in fotobook.php file as indicated above. use the fan page id not album id.
    3) add albums from fan page
    4) upgrade to 3.2

    if you try to add any more albums from this point, it gets real buggy and doesn’t work…

  25. Thanks for this, but any idea whether this hack would work for 2 fanpages under the same FB account?

  26. a. foushee – If you do an upgrade, it overwrites your modified file, so future updates would naturally be troublesome. Since I haven’t played with the latest version, what are the benefits of having it over 3.18?

    swcomm – Since you have to hard code the fan page ID into the file, it would only work with that one fan page.

  27. a. foushee

    May 26th, 2010

    hi chad, i don’t know what the benefits are or if there are any. i just know i was able to get multiple albums to display properly, with their thumbnails shown as well, by using the process above. just by adding the id of the fanpage as opposed to the specific album number. it’s buggy though, my client would never be able to update albums in the future and now one album stopped displaying photos altogether. i am encouraging him to move his photos from the fanpage over to his profile on FB, which isn’t ideal. he shouldn’t have to have duplicates. prior to the steps outlined in my previous post, the thumbnails would not display and the items were being listed in 2 columns even though the settings were not indicating as such. any ideas on when fotobook might be upgraded for fanpages? thanks!

  28. I sort of can’t believe this, but this actually works, but who knows for how long:

    http://bcbc.co.uk/mu/tintinnabuleur/2010/02/15/more-fotobook-changes/

    Am now importing 2 fanpage photo albums into Wordpress.

  29. a. foushee – Hmm. I’ve not ever tried to input an album ID. I’d imagine that wouldn’t work, since the plugin was built to gather all albums from a profile ID.

    swcomm – I just installed that plugin mod and activated it. It hid the post content body from being displayed across my whole site. Haha! That ain’t good.

  30. swcomm – Nevermind. I must have a plugin conflict going on, cos I just activated my own modded fotobook and the same thing happened. Dang.

  31. is it possibile to import the fan photos from a Facebook page? These photos are not in a album

  32. This link is dead…. can you please share what you did?

  33. Actually, reverting to 3.1.8 works.

  34. For those looking for the dead link, go here: http://tintinnabuleur.bcbc.co.uk/tag/fotobook/. I uploaded this plugin mod, and it worked like a charm the first time. Heck, it even remembered the facebook permissions granted to the original plugin.

  35. Excellent hack. Just what I was looking for. I used 3.1.8 by the way.

  36. Sorry people for breaking the link, I updated the link structure on my site. the old link should now redirect to here:

    http://bcbc.co.uk/mu/tintinnabuleur/2010/02/15/more-fotobook-changes/

    I’ve just updated my code to be based off the newest version of Fotobook by Aaron (which in fact just consisted of copying and pasting my mods).

    @Alex – Whilst doing the update I tried finding a way to get the fan photos. I couldn’t figure it out. It doesn’t help that Facebook’s documentation is pretty rubbish and some of their API examples don’t even work!

  37. So this works with version 3.2.1?

    Thanks

  38. It sounds interesting, just giving a try. Hope it works well.

  39. Every time Facebook updates they tend to change stuff like this so keep an eye on it.

  40. Hi Guys,

    Amazing tips! But it doesn’t seem to work for WP 3.0.. I keep getting this error and there is no line with ‘is_numeric’. I would like to show my fanpage pictures on this website (www.amyfeli.com) but it looks like wp 3.0 doesn’t support the old version of fotobook, any work arounds?

    Error:
    Fatal error: Uncaught exception \’FB_FacebookRestClientException\’ with message \’A session key is required for calling this method\’ in /home/dylan/domains/amyfeli.com/public_html/wp-content/plugins/fotobook/facebook-platform/facebookapi_php5_restlib.php:3003 Stack trace: #0 /home/dylan/domains/amyfeli.com/public_html/wp-content/plugins/fotobook/facebook-platform/facebookapi_php5_restlib.php(1608): FB_FacebookRestClient->call_method(\’facebook.photos…\’, Array) #1 /home/dylan/domains/amyfeli.com/public_html/wp-content/plugins/fotobook/fotobook.php(259): FB_FacebookRestClient->photos_getAlbums(151064224906968, NULL) #2 /home/dylan/domains/amyfeli.com/public_html/wp-content/plugins/fotobook/fotobook.php(665): FacebookAPI->update_albums() #3 /home/dylan/domains/amyfeli.com/public_html/wp-includes/plugin.php(395): fb_ajax_handler(\’\') #4 /home/dylan/domains/amyfeli.com/public_html/wp-admin/admin-ajax.php(1531): do_action(\’fb_ajax_handler\’, Array) #5 {main} thrown in /home/dylan/domains/amyfeli.com/public_html/wp-content/plugins/fotobook/facebook-platform/facebookapi_php5_restlib.php on line 3003

  41. Fotobook encountered an error while retrieving your photos. [Error #453]

  42. Used to work for me, Since I updated to WP3 and Fotobook 3.2.1 no Luck

    If there is any way around please share

    Shovan

Trackbacks

Leave a Reply

Asking for support? Win favor with a contribution for my time and expertise.