Embed Facebook Fan Page Photo Albums In WordPress

Embed Facebook Fan Page Photo Albums In WordPress

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.

53 Comments
  1. Nickk February 1, 20106:31 pm

    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. Chad Von Lind February 2, 201011:25 am

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

  3. Nickk February 2, 201011:27 am

    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. Chad Von Lind February 2, 201011:38 am

    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. Nickk February 2, 201011:39 am

    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. web February 3, 20101:58 pm

    Great hack, thanks!

  7. Chad Von Lind February 9, 20104:57 pm

    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. Nickk February 9, 20105:58 pm

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

  9. New York Herald February 24, 20103:25 pm

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

  10. sam March 12, 20101:34 pm

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

  11. ian April 8, 20104:16 am

    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. Shovan April 10, 20106:49 pm

    Great hack works for me

  13. Nick April 12, 20101:38 pm

    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. Chad Von Lind April 12, 20102:01 pm

    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. Andre Orlowsky April 16, 20103:45 pm

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

  16. oriol April 19, 201010:38 am

    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. novakkg April 21, 20104:38 am

    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. Chad Von Lind April 22, 20106:52 pm

    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. seeal May 7, 20103:50 am

    this fix it!!! thx :D

  20. web May 12, 201012:24 pm

    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. Chad Von Lind May 12, 201012:44 pm

    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. web May 12, 20101:04 pm

    word.

  23. Zee May 18, 20105:27 pm

    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 24, 20105:34 pm

    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. swcomm May 26, 20107:44 am

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

  26. Chad Von Lind May 26, 201011:14 am

    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 26, 201011:27 am

    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. swcomm May 26, 201011:38 am

    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. Chad Von Lind May 26, 201012:22 pm

    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. Chad Von Lind May 26, 201012:27 pm

    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. Alex June 3, 20109:10 am

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

  32. david June 11, 20101:07 pm

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

  33. david June 11, 20101:24 pm

    Actually, reverting to 3.1.8 works.

  34. Stephen June 28, 20106:26 pm

    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. Brent July 7, 201011:24 am

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

  36. Chris Wright July 8, 20102:50 am

    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. Stephen Reese July 15, 20107:18 pm

    So this works with version 3.2.1?

    Thanks

  38. iTechRoom August 5, 201011:26 am

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

  39. How to Hack Facebook August 8, 20101:43 pm

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

  40. Dylan van der Heij August 11, 20104:57 pm

    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. pepe August 21, 20104:49 pm

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

  42. Shovan August 21, 20105:35 pm

    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

  43. Johann September 8, 201011:39 pm

    Has anyone find a solution to show fan photos?

  44. Joy Albor September 16, 20105:44 am

    good post when are you doing a followup

  45. Joel October 6, 20103:53 am

    Hi,

    HAving your plugins updated is a security issue, i think.

    The current version is kind of far from the version we are using on this blog.

    I badly needed this funcionality, but it did not work on the current version of the plugin.. it did on the older though …

    Have you try to put it to work on the current version.. it would be GREAT.

  46. Lyndon October 30, 201012:35 pm

    Cannot import the Albums…what should i do? any help.thanks.

  47. Alex November 2, 20109:39 am

    there are news to get the fan photos?

  48. Steve Coley November 15, 20104:53 am

    Hi… Tried unsuccessfully with the latest version of Fotobook, so installed version 3.1.8. Altered the code accordingly, but when I try to import my albums I’m getting an “Fotobook encountered an error while retrieving your photos. [Error #114]” message???

    Any help?????

    Cheers

  49. Chris Wright November 15, 20105:04 am

    As far as I’m aware this is all due to Facebook’s latest updates to their privacy settings.

    It won’t make a difference what version of Fotobook you use with what version of WordPress and with what hack you use to get page photos. See here for comments from the developer:

    http://wordpress.org/support/topic/plugin-fotobook-cant-get-albums

  50. kostas December 6, 20118:19 am
Submit Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

To include your code, use pastebin, and paste the URL in the comment body. Failure to do so may prevent your comment from appearing. Thank you.