Facebook -> WordPress integration: fotobook

Recently I started to keep a fotoblog of my puppy Zora, the reason is that sadly, zora doesn’t live with me anymore because she lives with Cecilia now, who moved back to Amposta.

So I was feeling sad and thought that to cheer me up, or depress me more, I could start a fotoblog of all the happy memories I had and I could share with others who don’t have facebook.

The one thing I wanted to do was to import facebook albums, because I have a lot of cool pictures on it and I came across fotobook, which is really cool, you install it, connect it to your fb account, give permissions to access the albums and then import the album information which then lets you put that up on your wordpress blog.

One modification that I wanted to do to it though was that I wanted to import pictures from a fan page and also from my user account, which with the default, was not possible.

What follows below is a method to obtain albums from your account and any number of fan pages you want, here is how to do it

==========================

you will need to open the ftp of your wordpress and using your favourite editor, open the fotobook.php file from the plugin after it’s been installed, around line: 290, you’ll find a foreach() statemen and just below it $uid = $session[“uid”]; that is where all this starts.

the idea that someone had was to replace this with $uid = “123123123”; where the 123123 number is the id of the fan page, this works, but the problem is that you also lose the ability to import albums from your account, so I was thinking of a way to do both, import from fan pages AND your user account AND any number of other fan pages (because you can just repeat the function call multiple times as many fan pages as you want)

I posted this to the help forum, I copypasta it here also

==========================

I have an extension for this idea grabbing the fan pages.

as mentioned above, you can use the following code


//$uid = $session["uid"];
$uid = "12312312312"; <--- fan page id

but a muuuch better idea is to refactor the code that grabs the albums, so you can call it multiple times, with any fan page id you could want, I explain.

just above the line where you comment out the session uid and put the fan page id, you find a foreach() statement, which loops through and grabs albums associated with that session uid, the modification basically says, screw the session uid, choose the fan page id instead

my idea is this, create a new method like this:


function get_multiple_album(&$fb_albums,&$fb_photos,$page_uid=false){

}

inside that method, copy and paste the ENTIRE foreach statement, just above it, if you are not a developer, this will be hard, find someone to help you understand how to program, then try it.

paste the code into the new method you’ve called and where the foreach was before, replace it with something like this


if($this->get_multiple_album($fb_albums,$fb_photos) == false) return false;
if($this->get_multiple_album($fb_albums,$fb_photos,"123123123123") == false) return false;

where 1231231231 is obviously the fan page.

you also notice the first call to get_multiple_albums doesnt have a number like, 123123, it’s because that we are going to use a DEFAULT PARAMETER, to define that in this case, use your account, there is no fan page number, so use the account number instead

the benefit of this is now you can call it multiple times for any number of fan pages you might want to import from, you are not just limiting yourself to only one fan page, now you can import your accounts albums, plus any number of facebook fan pages.

inside the method, you will have to make a modification

where it USED TO SAY

$uid = $session["uid"];

replace it with

$uid = ($page_uid !== false) ? $page_uid : $session["uid"];

now go back to wordpress, import all your albums, hide the ones you want to keep private and you’re all set to go.

I hope it helps you

5 thoughts on “Facebook -> WordPress integration: fotobook”

  1. Pingback: Tintinnabuleur
  2. aha ok, that sounds a little easier than my hack, but I guess it’s all up to you, my hack allows you to have as many fan pages as you want used, I couldnt find a hack that allowed that so I had to program my own.

    thanks tintinnabuleur

  3. Pingback: Tintinnabuleur
  4. sorry there is not a lot I can do for you if you didnt follow the instructions, try asking someone who knows PHP and they can help you progress from here.

Leave a Reply

Your email address will not be published. Required fields are marked *