Facebook Wall Feed for WordPress Updated

An example of someone's Facebook Wall Feed on a WordPress blog
Here is an example of what it should look like if everything is set up properly.

*UPDATE – September 29, 2011: The new version of the code that includes the photos, links, etc are avail here:
uki_facebook_wall_feed_v0.9.5.phps
uki_facebook_wall_feed_v0.9.5.css*

*UPDATE – September 29, 2011: Discovered I missed a step in this write up for the 0.9.5 version of the code. After running through the set_access.php you need to copy the access token that is printed on the first line and put it in a file called fb_access_token.txt in your templates base directory. I went ahead and updated this post but wanted to highlight it here so people who have already read it will know there was a change.*

At the beginning of June Facebook changed some of their OpenGraph API calls. They now require an authentication token for everything. This of course broke the code I previously wrote for displaying your Facebook wall feed on your WordPress blog. I figured this would be easy to fix, but it actually took longer to come up with the answer than I had anticipated.

Unfortunately there wasn’t much documentation on how to fix my exact issue so I had to piece together information till I finally got it all right. Besides just getting the authentication token, you have to make sure you ask for the correct access. I’m not sure why Facebook turned something so simple into something so complicated. After a few trials and errors I came up with what I believe is the right level of access.

So to get my code to work you have to do a few steps. I’ll try my best to go through the steps and explain things as I go.

Step 1: Create a Facebook App

You need an app id in order to make calls to get an authentication token. To create your Facebook App go here: https://www.facebook.com/developers/apps.php.

The process should be pretty self-explanatory. You enter a name. I would suggest just making it the name of your blog. Then you agree to the terms and click submit. The only other thing you might want to fill out is the website information. You can fill in your website and domain there. Other than that you are done with that part.

Facebook Application Information Page
After creating your Facebook Application you should see a page similar to this. This is where you will get the information that is needed in the rest of the instructions.

Step 2: Get the App Secret

The main reason you need to create a Facebook App is so that you can have the app secret. You will need this information to make a call for the access token. Write down or copy the app secret and app ID from the application info page. See example above.

Step 3: Run Script to Grant Permission to the App

Next you will need to grant permission for your Facebook App to get access to the relevant information from your Facebook profile. To do this you can either fill in the information on a setup Facebook permissions page I created or you can upload the script (set_access.phps) to your server and run it from there. To use the web page I setup you will need your Facebook ID, your Facebook App ID, and your Facebook Secret.

What the web form looks like for setting the Facebook App access
This is what the web form will look like if you choose to use the web page I created for setting your Facebook App's access rights.

You will enter that information and click on “Set Access”. Once you do that it should bring up a Facebook dialog box that asks if it is ok to give your Facebook Application access to your Facebook profile information. Click on “Allow” and it’ll set the permissions. The next screen should how a bunch of output which is actually the JSON objects of your Facebook wall feed. I do not store any information from these pages.

Example of Facebook App requesting permission for Facebook profile information
This is an example of what it should look like when your Facebook App asks for permission to access your Facebook profile information.
An example of what the expected output should be like after the access is set
This is what you should expect to see after you enter your information and allow your Facebook App access to your Facebook profile information.

If you choose to download the script to run on your own server, please remember to change the following:

  • Change the file extension from .phps to .php
  • Change the $app_id variable from YOUR_APP_ID to your actual Facebook App id that was created earlier
  • Change the $fb_id variable from YOUR FACEBOOK_ID to your actual Facebook id
  • Change the $app_secret variable from YOUR_APP_SECRET to your actual Facebook App Secret that was created earlier
  • Change the $my_url variable from http://YOUR_WEBSITE_URL/set_access.php to the actual location you saved the file too

The lines of code in the script that need to be changed will look like the following:
$app_id = "YOUR_APP_ID";
$fb_id = "YOUR_FACEBOOK_ID";
$app_secret = "YOUR_APP_SECRET";
$my_url = "http://YOUR_WEBSITE_URL/set_access.php";

Once you have it uploaded on your site you just go to the page in your web browsers. It should do the same thing things mentioned about the page I created. The only difference will be that your information is hardcoded in the script instead of you inputting it into the web page.

If you are using version 0.9.5 of the code you need to do one more thing in this step. Once the script is run, you should see a line at the very top that says ACCESS TOKEN = xxxxxxxxxxxx. Copy what is after the equal sign (the xxxxxxxx part) and put it in a file named fb_access_token.txt in your templates base directory. If you aren’t using WordPress you will have to edit the class file and specify where you put the fb_access_token.txt file.

Step 4: Download and setup the files

Now all you need to do is download the Facebook Wall Feed class file, the Facebook like CSS file, and add the code to your sidebar or where ever you want to put your Facebook wall feed. You should upload these files into your current theme’s directory. As always please be sure to change the extension from .phps to .php and then you should only have to add the following lines of code where you want your Facebook wall feed to show up:

<link href="<?php echo get_template_directory_uri(); ?>/uki_facebook_wall_feed.css" rel="stylesheet" type="text/css" />
<?php
include("uki_facebook_wall_feed_v0.9.php");
$feed = new uki_facebook_wall_feed('YOUR_FACEBOOK_ID', 'YOUR_APP_ID', 'YOUR_APP_SECRET');
$feed->get_fb_wall_feed();
$feed->display_fb_wall_feed();
?>

Don’t forget to use your information in place of “YOUR_FACEBOOK_ID”, “YOUR_APP_ID”, and “YOUR_APP_SECRET”. This code can be used for any website. It isn’t really specific to WordPress. I want to eventually make it a WordPress plugin but still haven’t had time to learn how. So if someone would like to turn it into a WordPress plugin, I would be glad to help or you can just use the code. Please just be sure to leave my header in the class file so I get credit for what I have done.

If you do wish to use this for a non WordPress site just change the link code for the css and the rest should still work. Your site of course must have php because that is what the code is written in. Most hosting companies tend to have that easily available. So just change <link href="<?php echo get_template_directory_uri(); ?>/uki_facebook_wall_feed.css" rel="stylesheet" type="text/css" />
to
<link href="uki_facebook_wall_feed.css" rel="stylesheet" type="text/css" />

As I get time, I still plan to include more types of updates that appear on the wall feed. Right now it just takes the ones that are marked as type “status”. I eventually want to make it where it will display links, photos, videos, and check-ins. I’ll make updates and post them as I get around to them. If anyone has any suggestions or questions just leave a comment or send me an email. I will do my best to answer as quickly as possible.





Facebook comments:

Fedil

I was originally born in Missouri, but traveled around most of my childhood. My mom finally got tired of moving while we were in Dallas, Texas and I have been here ever since. After high school I started college at the University of North Texas (UNT) and started working in the computer field. I currently work for JCPenney as a front end software engineer for their e-commerce website. Before this I worked for AT&T about 12 years and started with them in 1999 (when they were Southwestern Bell). I have many passions and I really love photography. Besides photography I also love sports. I not only like to watch it, but I also love to play. Currently my friends and I play indoor soccer and flag football.

110 thoughts on “Facebook Wall Feed for WordPress Updated

  • Pingback: Facebook Wall Feed for WordPress « Fedil's Blog

  • June 28, 2011 at 12:15 am
    Permalink

    Making more progress with the code. If you notice my status box on the sidebar it now has videos, photos, and links. I’m still flushing out everything to try and make it exactly like the Facebook Wall. I hope to have a new version of the code up within a week. Maybe I’ll get to it this weekend. All the instructions should remain the same. I’ll just post links to the new code.

    Reply
  • July 1, 2011 at 7:01 am
    Permalink

    thanks for this code… super useful function
    it is coming up blank at the moment
    is there an easy way to debug it to work out what is happening?

    Reply
    • July 1, 2011 at 9:33 am
      Permalink

      The first thing I would do is go through the set access part again and make sure you see output similar to the one shown in the graphic for that part. Then in the class file you should see a couple of echo statements commented out. You can uncomment them just to make sure it is making the class calls.

      Reply
      • July 5, 2011 at 12:46 am
        Permalink

        ok brilliant – i will do that – the output is working fine… i’ll try the echos
        thanks again!

        Reply
        • July 5, 2011 at 10:58 am
          Permalink

          Cool. Keep me updated on how it goes!

          Reply
  • July 10, 2011 at 11:11 am
    Permalink

    I just want a basic simple URL that RSS feeds my facebook statuses to my blog or website. Not all this complicated stuff, I don’t have time for it. Facebook should be making this much easier.

    Reply
    • July 10, 2011 at 11:42 am
      Permalink

      Yea that would be nice, but I haven’t seen a way to do it for a couple years now. I’m not sure if Facebook just does a really good job of hiding it or if they have completely removed the RSS feeds for your wall posts.

      Reply
  • August 1, 2011 at 5:48 am
    Permalink

    Can I ask what is probably a totally basic and stupid question. Is it possible to add this code in as a widget on the sidebar – or on an actual page/post? It doesn’t like it when I try. I can get it working in the header for instance – I’m probably missing some basic tags or something. Thanks for any help as this is great.

    Reply
    • August 1, 2011 at 9:53 am
      Permalink

      It is possible to put the code into a widget or post. Unfortunately you will have to get a plugin that allows php code. By default WordPress doesn’t parse php code. So it will get changed. For widgets I use the plugin: “PHP Text Widget”. Download that and activate it and then you can add php code in a text widget on your sidebar. I’m not sure what plugin to use for posts though. I’m sure it wouldn’t take too long to look up and find though. Let me know how it goes.

      Reply
      • August 2, 2011 at 4:25 am
        Permalink

        Humm.. Thanks for this info… that’s the exact widget I’ve been using funnily enough.. this is the error I get. I’m sure it’s something basic I am doing wrong.. but like I say if I paste the code into header or footer it works perfectly.

        include(uki_facebook_wall_feed_v0.9.php) [function.include]: failed to open stream: No such file or directory in /home/XXXXXXXX/public_html/wp-content/plugins/wp-php-widget/wp-php-widget.php(52) : eval()’d code on line 3

        Reply
        • August 2, 2011 at 4:42 pm
          Permalink

          Looks like you didn’t upload the actual class file (uki_facebook_wall_feed_v0.9.php). You have to upload that to your server. I think if you upload it to /home/XXXXXXXX/public_html/wp-content/plugins/wp-php-widget/ then it should work fine.

          Reply
  • August 3, 2011 at 4:19 am
    Permalink

    ah brillant! – sorted… thanks so much.. knew I was making a school boy error somewhere along the line! Thanks again for your time. Look forward to the new code with the photos, links etc!

    Reply
  • August 6, 2011 at 5:11 pm
    Permalink

    This seems to be the only thing out there that pulls the wall feeds with the correct API. Do you think that this would work with pages too as they have their own FB ID?

    I am trying to pull our FB page wall into our blog and format it how we want it, but with FB removing RSS feeds this is a recent impossibility.

    I am more than willing to make this a WP plugin, but I would rather start with the code you are using that shows more than the status’ as it may have some re-writes.

    Reply
    • August 8, 2011 at 2:58 pm
      Permalink

      Sounds great. I’ll get that posted sometime this week. This past week and weekend have just been crazy busy for me.

      Reply
    • August 8, 2011 at 2:59 pm
      Permalink

      I’ll try to look at it this week and see what’s going on. If you figure it out before I get to it just let me know.

      Reply
      • August 19, 2011 at 10:17 pm
        Permalink

        I think the permissions page needs to be updated to include a url variable to be parsed. Fb seems to be rejecting the permision when called from a url that is not the destination url.

        I’ll have a look at it and if it is an easy fix I’ll upload a sample for you all here.

        Dave

        Reply
  • August 12, 2011 at 3:11 am
    Permalink

    Bravo Fedil!

    Excellent work.

    How to customize content inside Facebook Status box:
    1. Change input on application page
    2. Change code in uki_facebook_wall_feed
    3. ?

    Thanks in advance.

    Reply
    • August 19, 2011 at 10:15 pm
      Permalink

      Hi Drago

      I’ve done a bit of this work on Fedil’s app and how I got things like links showing was to follow the following steps:

      1. print_r the $fbFeed variable to see the content of the returned array
      2. Created a switch statement with cases for different types of content
      3. Made sure I matched the variables to the function call at the end of the declaration of variables ($this->print_fb_post($fbStoryID, $fbPhoto, $fbID, $fbName, $fbMsg, $fbTitle, $fbLink, $this->parse_fb_timestamp($fbTime));) You may notice I have added in some extras for the feed.
      4. The key to getting this all working is to ensure that the content you want displayed is captured correctly from the [“data”] array ($fbFeed) and it gets displayed in the bottom section of the class (function print_fb_post).
      5. If you create a new style of formatting for your status box, make sure it reflect in the provided css file.

      I have only done this for links so far, my intention is to develop it to suit all content types. Links are particularly tricky depending on how the user completes the entry… I have quite a complex version of the class file that also displays links. You can see the status box on [link]http://heart1stop.com/services/mortgage-broking/[/link] Like I said still some work to do, then once it is all working as expected, providing Fedil is happy for me to so, I intend to develop a very user friendly WP-Plugin for this class.

      Hope this helps

      Dave

      Reply
  • August 18, 2011 at 9:56 pm
    Permalink

    Hi Fedil

    First of all, great script! This has been a godsend. I’m starting to customize it a bit for a specific application for one of my clients. Once I’m super happy with it, I plan to develop it into a WP-Plug-in (with your blessing of course.)

    One issue I am running into at the moment is trying to get two different feeds on two different pages. (finance account on finance page, mortgage broking account on mortgage broking page.)

    I’ve overcome a number of hurdles associated with doing this, but cannot seem to get the second account to authorise… Any ideas?

    Where I’m at…

    All variables are being parsed correctly to the class and I can echo them out of the class as expected.
    Blank array returned as [“data”]
    Both apps work fine for the authorised account.
    I have tried on your auth page which fails, and also on authpage created on my site which automatically redirects to my website.

    I’m 95% sure the problem is in the authorisation, but running the script gives symptoms like it has already been authorised. Do you know any way to override that and force a new authorisation?

    Thanks for your help

    Dave

    Reply
    • August 19, 2011 at 10:06 pm
      Permalink

      UPDATE:

      I have since created a new APP and run the authorisation script again successfully. Problem is still getting no feed through. This is really unusual as I can put the fbId from the other account and app works fine, when I replace with the account I want, I get nothing back from the call to fb.

      Is there some bizzare rule within fb that prevents me from showing the feed to more than one account on a specific website, or from having apps with feeds from more the one account under a single account ID. (Both apps have been created under my fb account).

      Help….

      Dave

      Reply
      • August 21, 2011 at 1:21 am
        Permalink

        UPDATE:

        I figured out (I think). The problem was nothing to with the API, the class or anything else. The page that I was trying to retrieve data from had their setting set to only allow those signed in with Facebook view the content. The other page was open to the public.

        I’m slightly annoyed I wasted so much time trying to get to this point, but at least I know the problem now.

        Dave

        Reply
        • August 24, 2011 at 10:44 am
          Permalink

          Glad you got it. Yea I hate wasting time on little things like that too, but it happens LOL

          Reply
    • September 15, 2011 at 10:01 am
      Permalink

      Hey Dave,
      I thought I would hit you up and see if you had an update on your usage. Hopefully the code has been working for you and meeting your needs.

      Reply
  • August 19, 2011 at 10:21 pm
    Permalink

    Hi Fedil

    Can you make the script for your permissions page available. It will save me creating one from scratch. you can e-mail to my e-mail provided, or make it available for download here.

    Thanks

    Reply
    • September 15, 2011 at 9:58 am
      Permalink

      Sorry about the delay. I must have missed this message. Have you had a chance to look at it anymore? First off I would start by making sure that your permissions are set to allow anyone to see your wall posts. Second when you go through the steps do you see output of your wall info in Step 3? It should look similar to the image that is posted in that section after setting the access.

      Reply
    • September 29, 2011 at 11:02 am
      Permalink

      Please see the update at the top of the page. If you are using the updated version this could be why it is blank.

      Reply
  • August 24, 2011 at 10:51 am
    Permalink

    Sorry I’ve been MIA guys. Been a busy summer. I also just recently got a boat so my weekends have been out on the lake. I’m glad some of you have taken it upon yourselves to try and improve the code and make it into a plug-in. You guys definitely have my blessing to use it. I just ask that you include me some where in the credits.

    With that being said, I’m going to try and make more time and go through your questions. Also here are the updated class file and css for the version I’m using with the links, photos, and stuff:
    http://www.ukneeq.com/testing/uki_facebook_wall_feed/uki_facebook_wall_feed_v0.9.5.phps
    http://www.ukneeq.com/testing/uki_facebook_wall_feed/uki_facebook_wall_feed_v0.9.5.css

    Reply
    • September 22, 2011 at 6:33 pm
      Permalink

      I tried implementing your new php code but now I get errors:

      Warning: fopen(/homepages/7/d328811302/htdocs/teamalter/wp-content/themes/twentyeleven/fb_access_token.txt) [function.fopen]: failed to open stream: No such file or directory in /homepages/7/d328811302/htdocs/teamalter/wp-content/themes/twentyeleven/uki_facebook_wall_feed_v0.9.5.php on line 29

      Warning: filesize() [function.filesize]: stat failed for /homepages/7/d328811302/htdocs/teamalter/wp-content/themes/twentyeleven/fb_access_token.txt in /homepages/7/d328811302/htdocs/teamalter/wp-content/themes/twentyeleven/uki_facebook_wall_feed_v0.9.5.php on line 30

      Warning: fread(): supplied argument is not a valid stream resource in /homepages/7/d328811302/htdocs/teamalter/wp-content/themes/twentyeleven/uki_facebook_wall_feed_v0.9.5.php on line 30

      Warning: fclose(): supplied argument is not a valid stream resource in /homepages/7/d328811302/htdocs/teamalter/wp-content/themes/twentyeleven/uki_facebook_wall_feed_v0.9.5.php on line 32

      when I return the config to the previous v0.9.php the feed comes back up.

      Any ideas?

      Thanks for all your hard work!

      Reply
      • September 29, 2011 at 10:56 am
        Permalink

        I completely forgot that in the new version it needed to save the access token that was given when you set the permissions for your facebook app. Maybe this is an issue others are having. Re do the set_access.php step and it should now display the access_token in the output. Copy that and put it in a file called fb_access_token.txt in your templates base directory. That should solve the problem you are having. I’ve updated the post to now include this step.

        Reply
  • August 29, 2011 at 7:35 pm
    Permalink

    Hey Fedil

    This is really awesome, thanks for the info. Unfortunately, I am also getting a blank wall feed. #facebook_status_box is rendered, just nothing within it. Any suggestions? Thanks in advance for your help!

    Phil

    Reply
    • September 9, 2011 at 11:07 am
      Permalink

      When you did the set_access step did it show a bunch of output that should have resembled your status updates on your wall???

      Reply
    • September 29, 2011 at 10:57 am
      Permalink

      Please see the update at the top of the page. I completely forgot to add a step with the new version of the code. Sorry.

      Reply
  • September 9, 2011 at 11:14 am
    Permalink

    For anyone who was working on making this a WP Plugin please let me know how you are progressing.

    Reply
    • November 29, 2011 at 11:08 pm
      Permalink

      Hi Fedil,

      I was able to incorporate your code into a plugin. I hope I’m not to late to the party. Please feel free to try it out and let me know what you think. You can find it at http://takanudo.com/jsl3-facebook-wall-feed. Thanks for the inspiration.

      -Takanudo (hopes this works out for everyone)

      Reply
      • November 30, 2011 at 1:31 pm
        Permalink

        Hey Takanudo,
        I believe you are the first to make it an actual plugin. At least you are the first to post about it. Looks good from what I saw. I’ll try to check it out completely tonight. Good work!

        Reply
  • September 15, 2011 at 7:45 am
    Permalink

    I have this error code
    [code]
    API Error Code: 191
    API Error Description: The specified URL is not owned by the application
    Error Message: Invalid redirect_uri: Given URL is not allowed by the Application configuration.
    [/code]

    what sould i do?

    Reply
    • September 15, 2011 at 9:49 am
      Permalink

      Looking it up that usually is a problem with the URL that you entered when setting up your facebook app. Please go to your facebook app page and make sure the url and domain you are specifying matches the website you are using.

      Reply
  • September 15, 2011 at 8:39 am
    Permalink

    and i get this warning message in index file :

    Warning: filesize() [function.filesize]: stat failed for http://xxx.xyz/fbtes/fb_access_token.txt in /home/xxxx/public_html/fbtes/uki_facebook_wall_feed.php on line 30

    Warning: fread() [function.fread]: Length parameter must be greater than 0 in /home/xxxx/public_html/fbtes/uki_facebook_wall_feed.php on line 30

    and feed still blank

    Reply
    • September 15, 2011 at 9:50 am
      Permalink

      This is probably a result of your previous error you posted. Without it getting an access_token, it can not pull your wall info.

      Reply
    • September 29, 2011 at 11:03 am
      Permalink

      Going back over my code I realized I forgot to add a step needed with the newer version. You need to create the fb_access_token.txt and just have the access token in it. To get the access token re-do the set_access.php step and it should now print out the access token at the very top of the output.

      Reply
  • September 16, 2011 at 8:47 pm
    Permalink

    He Fedil

    I’ve been away from the office for a few weeks, but you can see where I’m at here:

    http://heart1stop.com/services/financial-consulting/ and here:
    http://heart1stop.com/services/mortgage-broking/

    I’ve modified it a bit from your code, still a fair bit to do for all of the content types to work but it is certainly a good start. My client (hence me :)) is very happy with the result.

    When some spare time presents itself I will keep working on it and develop it into a WP plug-in. Hopefully have it finished in time to release in the new year.

    Dave

    Reply
  • September 20, 2011 at 8:55 am
    Permalink

    I installed this today. It works fine if I add the code manually in for example sidebar.php. But if I add it in a text widget (I have PHP Text Widget installed), there is no code being output after the link to uki_facebook_wall_feed.css (which is correct, so the php code in the link works). That is, the part with include(“uki_facebook_wall_feed_v0.9.php”); doesn’t work and stops any HTML code after that, so the site looks weird. Any idea why this might be?

    Reply
    • September 20, 2011 at 1:19 pm
      Permalink

      Yea that doesn’t work because the plug-in you are using for the PHP Text Widget has it’s own default directory. So when for the include statement it is looking in it’s directory for that file. So you either have to copy the files to that plugins directory or edit the include to point to the full path of the files.

      Reply
  • September 21, 2011 at 12:54 am
    Permalink

    Thanks for your reply! I moved uki_facebook_wall_feed_v0.9.php to /wp-content/plugins/php-text-widget and changed nothing in the widget. Then there are no errors, but also nothing from Facebook shows up.

    If I try to set another include path I get this error (get same error if I write the full path): Warning: include(): open_basedir restriction in effect. File(../../themes/synchronize/uki_facebook_wall_feed_v0.9.php) is not within the allowed path(s):

    Do you have an example of code in PHP Text Widget that works? Could my hosted server have restrictions on include() ?

    Reply
    • September 21, 2011 at 11:12 am
      Permalink

      Unfortunately I haven’t used it in the Widget. I’ll see if I can do it later tonight and see what it gives me. I just have it hardcoded right now in my sidebar.php file. I’ll let you know what I find when I try the Widget tonight.

      Reply
        • September 22, 2011 at 10:15 am
          Permalink

          I tried it with the plugin php code widget and just copied the php class file to the plugin directory. It didn’t work for me at 1st but discovered that it was because I still had my original code in the sidebar. After I removed that it worked fine in my widget.

          Reply
          • September 22, 2011 at 1:13 pm
            Permalink

            Was that with the PHP Code Widget or the PHP Text Widget?

          • September 22, 2011 at 2:06 pm
            Permalink

            The exact plugin I’m using is: Executable PHP widget by Otto.

          • September 23, 2011 at 2:05 am
            Permalink

            Strange, that’s the one I’m using too. But the include part doesn’t work. I uploaded uki_facebook_wall_feed_v0.9.php to /wp-content/plugins/php-code-widget. But the output is only this:

            I don’t have the code in sidebar.php, although uploaded uki_facebook_wall_feed_v0.9.php is also in the themes dir.

            The code in the PHP Code widget is this (appID and app secret replaced by nnn):

            <link href=" /uki_facebook_wall_feed.css” rel=”stylesheet” type=”text/css” />

            Any idea why the Facebook feed is not showing up?

          • September 23, 2011 at 5:30 am
            Permalink

            Oh, I see the php tag was not included. This is supposed to be within the php tag after the link to the CSS. Anything wrong with that?

            include(“uki_facebook_wall_feed_v0.9.php”);
            $feed = new uki_facebook_wall_feed(‘dwestergren’, ‘nnn’, ‘nnn’);

          • September 29, 2011 at 12:44 pm
            Permalink

            Hmm, it’s actually outputting updates that are not public… There was a reason I made some updates not public. Is the script outputting everythingm, regardless of who it has been shared with? I think version 0.9 only output things I hade shared publicly.

        • September 23, 2011 at 11:43 am
          Permalink

          Here is the code that I put in that worked:

          <?php
          include(“uki_facebook_wall_feed_v0.9.5.php”);

          $feed = new uki_facebook_wall_feed(‘nnnnn’, ‘nnn’, ‘nnn’);
          $feed->get_fb_wall_feed();
          $feed->display_fb_wall_feed();
          ?>

          Looking at what you just put previously you didn’t include the display_fb_wall_feed();

          Reply
          • September 24, 2011 at 2:54 am
            Permalink

            Ah, I must have accidentally deleted those lines. Thanks! Now it works like a charm. I see your version is 0.9.5. Mine is 0.9, is the newer version available for download?

          • September 24, 2011 at 10:38 am
            Permalink

            Yes the new files are available to be downloaded. They should be in the comments. So just scroll up through them. If you can’t find them let me know and I’ll repost.

          • September 25, 2011 at 2:12 pm
            Permalink

            The 0.9.5 version is not working for me. The section is just empty… Did just the same was as with the 0.9 version and also uploaded the new CSS.

          • September 26, 2011 at 11:17 am
            Permalink

            That’s weird. There are no errors or anything? The updated files are in the same directory? Also you don’t have any other calls setup? It should be interchangeable because the only difference in code is that it looks for pics, links, etc…

          • September 28, 2011 at 12:15 pm
            Permalink

            This is what is output when I have debug on:

            Warning: fopen(/wp-content/themes/synchronize/fb_access_token.txt): failed to open stream: No such file or directory in /wp-content/plugins/php-code-widget/uki_facebook_wall_feed_v0.9.5.php on line 29 Warning: filesize(): stat failed for /wp-content/themes/synchronize/fb_access_token.txt in /wp-content/plugins/php-code-widget/uki_facebook_wall_feed_v0.9.5.php on line 30 Warning: fread() expects parameter 1 to be resource, boolean given in /wp-content/plugins/php-code-widget/uki_facebook_wall_feed_v0.9.5.php on line 30 Warning: fclose() expects parameter 1 to be resource, boolean given in /wp-content/plugins/php-code-widget/uki_facebook_wall_feed_v0.9.5.php on line 32 Notice: Undefined index: data in /wp-content/plugins/php-code-widget/uki_facebook_wall_feed_v0.9.5.php on line 45

          • September 29, 2011 at 10:06 am
            Permalink

            Well it looks like I missed a step in my write up. For some reason I thought the set_access.php script put the access_token that is provided in the necessary file. Maybe this is an issue others are having. When you did the set_access.php step it should have spit out a URL with the variable access_token in it. Copy that and put it in a file called fb_access_token.txt in your templates base directory. That should solve the problem you are having. I’ll update the page or just including that step in the set_access.php script.

          • September 29, 2011 at 12:40 pm
            Permalink

            That did the trick! Thanks.

            I do get several items that are empty: http://danielwestergren.se/

            What are those? Are those updates that the script can’t interpret? Can they be omitted from the output somehow?

          • September 29, 2011 at 12:45 pm
            Permalink

            And last comment… it also outputs things that others have been writing on my wall. Can I omit those somehow also? I only want to output what I have shared myself and only the public updates/photos/links etc.

          • September 29, 2011 at 1:13 pm
            Permalink

            I’m not sure what the blanks are. If the post isn’t a status, link, video, or photo it should be ignored. I’ve never seen a blank one before. If you run the set_access.php it should print out everything. If you can find the code that matches it and send to me I can see why the code isn’t parsing it correctly.

            As far as the privacy posts. I figured it just used the facebook privacy controls. I know facebook just recently added the part where you could post it publicly, to just certain lists, or to just certain groups. Not sure how that is effected in what is spit out by the code. I haven’t had time to look into it yet.

            The code does display what others post to your wall by design. I originally wrote the code so I could basically have an exact replica of my facebook wall on my blog. If you don’t mind tinkering with the code you can easily add a check to ignore any post that wasn’t created by you.

          • September 30, 2011 at 1:22 am
            Permalink

            Ok. I looked at the set_access.php output and have a few thoughts:

            1) What outputs empty is likes, happy birthday’s on other people’s walls, when I’ve written on a page etc. There is no [message] tag in those objects, but instead [story]. So maybe it’s possible to filter out objects that has no [message] tag?

            [type] is still “status” for those updates though, that’s why they are being output.

            2) As for privacy settings, there is a [privacy] tag that has a [value] of ALL_FRIENDS, EVERYONE (if it’s public), CUSTOM etc. and it also holds a value for [allow] and [deny] that are 0 if not set or the id of the friend(s) to display it for if [value] set to CUSTOM. The script could look for and only display posts where the [privacy] [value] is EVERYONE (since a website is public…).

            3) As for hiding messages from others than myself, I guess the script could look for the [from] tag and only output if [id] us the same as the first part if the [id] tag? That is the part before the underscore.

            I’m not a PHP expert, but could fiddle around a bit with this now in the morning, and will post something if I figure it out before America wakes up 🙂

          • September 30, 2011 at 5:34 am
            Permalink

            Ok, that wasn’t very difficult. I made some edits in the php file and also in the CSS (to my liking, to make it look more like the new timeline profile, with the date at the top). The files can be downloaded here:

            uki_facebook_wall_feed_v0.9.6.php and here uki_facebook_wall_feed.css

            Changes I made:
            1) Only display public updates, links, photos and videos (which automatically hides messages from others also)
            2) Only display a status message if it has a [message] tag, that is do not displat posts I have made on other peoples walls or pages.
            3) Changed the code for the date and time, to make it easier to set the locale, set the timezone and format the output with strftime (particularly for non-American users)
            4) Changed the order of the HTML output, to resemble the new profile timeline.
            5) Added number of likes to a post, although not displayed if there are no likes.

            Maybe it’s also possible to add a link to like a post, show number of shares, show number of comments etc. But this is what I needed for now.

            Now, does this make it possible to create custom RSS feeds of posts only shared with a particular group of people? Interesting…

          • September 30, 2011 at 12:08 pm
            Permalink

            Daniel,
            Thanks for taking the time to make these changes. I haven’t had a chance to try it out yet. Hopefully this weekend. Yea I haven’t even started looking at how the timeline view was going to look or act yet. Good work though!

  • October 11, 2011 at 10:10 am
    Permalink

    Hi!
    Thank you for your wallFeed, but there is something wrong.

    Script is working until line:

    curl_setopt($ch, CURLOPT_URL, “https://graph.facebook.com/$id/feed?limit=100&$token”);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $this->fbWallFeed = json_decode(curl_exec($ch), true);

    https://graph.facebook.com/$id/feed?limit=100&$token
    written in my browser (with correct substitutions) lists a lot of data (such as my name etc)
    but after that $ch has only a value “Resource id #6”
    and print_r($this->fbWallFeed)
    doesnt show anything at all? Can you help me?

    Reply
    • October 11, 2011 at 10:36 am
      Permalink

      Can you send me the output from when you type in that url in your browser. Just so I can see the data that it is giving you. Because if that is working then it should just parse it with the json_decode function.

      Reply
  • October 22, 2011 at 9:17 am
    Permalink

    Daniel W, can you check your files again cos the php file does not download only the css.

    Fedil, I get undefined index on message,icon I found out that message does not exist as an index after doing a print_r. As a result of this I get empty container rendered.

    Could there be a problem on my side?

    I am not using wordpress.

    Reply
    • November 7, 2011 at 12:11 am
      Permalink

      “pulled all the info from my wall *correctly*”…typo. 🙂

      Any ideas on why this isn’t displaying anything in the box?

      Reply
    • November 7, 2011 at 11:54 am
      Permalink

      I’m not sure about how fan pages work. Without knowing exactly it might be that the objects it pulls from fan pages doesn’t match what I look for coming from profile pages. Could you please send me a snapshot of your set_access.php output or past it in a reply.

      Reply
    • November 9, 2011 at 9:38 am
      Permalink

      Sorry I have had not had time to look at it. I’ve been pretty busy with some other things. I’ll try to get to it tonight or tomorrow. Again sorry for the delay.

      Reply
    • November 14, 2011 at 3:02 pm
      Permalink

      So sorry for the long delay. I think you are right in your assumption previously that your host may not have the curl libraries for php. I took your url that you showed previously and tested it on my server: http://www.ukneeq.com/testing/uki_facebook_wall_feed/ts.php

      Your info shows up there and that is how it should appear on your own servers.

      Reply
  • November 9, 2011 at 9:31 pm
    Permalink

    Daniel W,

    Are you able to re-upload the php file you updated. The one on your post appears to be blank.

    Fedil – Awesome work.

    Thanks

    Reply
  • December 16, 2011 at 10:14 am
    Permalink

    I’ve run into a bit of a brick wall. I’m NOT using WordPress on the site I’m working on and I’m not that great with PHP. I’ve followed all the steps provided, but me not using WordPress, I feel is what has lead to me getting this error:

    Fatal error: Call to undefined function get_template_directory() in /home/u575898647/public_html/test/uki_facebook_wall_feed_v0.9.5.php on line 28

    I don’t know where to go from here or what I’m supposed to change in the code. Any help would be greatly appreciated. Thanks.

    Reply
    • December 16, 2011 at 5:22 pm
      Permalink

      Nvm, I figured it out. Thanks for this awesome script.

      Reply
      • December 22, 2011 at 4:55 pm
        Permalink

        Glad you figured it out. Sorry I was out of town snowboarding and today is my first day back! 🙂

        Reply
  • December 26, 2011 at 6:00 pm
    Permalink

    I’ve just about got the wraps on a WordPress Plugin / Widget version of this. Let me know if you still need one, and I’ll try to get it to you. Also pulls statuses in addition to wall feed.

    Reply
    • January 4, 2012 at 4:52 pm
      Permalink

      J. Michael, Thanks for your interest. Not sure if you saw, but Takanudo also used my code for his plugin (http://takanudo.com/jsl3-facebook-wall-feed/). You might try checking his out and getting with him to see if you guys can either help each other or if it’s different enough to maintain two plugins.

      Reply
      • January 4, 2012 at 4:56 pm
        Permalink

        I did notice, yes. Our plugin works with status updates, rather than the wall posts / news feed. I’m thinking there might be a good venue for having a full-functioning plugin that would allow the webmaster to choose which feed(s) are pulled in, and perhaps customize the display a bit. Would be happy to work with Takanudo on that if there’s interest.

        Reply
        • January 4, 2012 at 5:05 pm
          Permalink

          Cool. Well there is always room for improvement and functionality! 🙂 Just let me know when you are done and I would love to take it for a spin.

          Reply
  • April 14, 2012 at 12:24 am
    Permalink

    I’m having trouble with the authorisation for this plug in.
    I go to click save changes it directs to facebook for authorisation and then just says ‘an error occurred’. Not very helpful to you but do you know what might be happening.
    I can’t get the access key from your permissions page here either.
    I’m trying to display feeds for my facebook page (public) – not my profile, does you plugin even do that?

    Reply
  • May 30, 2012 at 4:58 pm
    Permalink

    I’m sorry but the “site URL” dont exist anymore in creation of facebook’s app… Do you know how to do within it ? Thank in advance !

    Reply
    • May 31, 2012 at 12:57 pm
      Permalink

      Unfortunately I haven’t really looked at this since Facebook started making a lot of changes. Maybe someone else has been keeping up to date on it. I’ve really stopped working on this since a plugin (http://takanudo.com/jsl3-facebook-wall-feed) was made and I’ve started doing iOS mobile apps. Sorry!

      Reply
    • July 23, 2012 at 12:01 pm
      Permalink

      Looks like your plug-in has a fee though.

      Reply
        • July 23, 2012 at 12:09 pm
          Permalink

          LOL…very true. Yea I just wanted to add that so people knew what to expect. Nothing wrong with charging for your time and efforts! Good luck!

          Reply
  • September 28, 2012 at 10:00 am
    Permalink

    Hey Fedil.

    Nice work, too bad it (probably) doesn’t work anymore because of Facebooks recent changes due to offline_access being removed etcetera. Just wanted to let you know I’ve created a plugin that fetches posts from your profile or fanpage and have you show them in a widget list.

    It would be great if you could check it out; Recent Facebook Posts Widget.

    Let me know what you think!

    Danny

    Reply
    • October 26, 2012 at 1:45 pm
      Permalink

      Thank you! Yea I haven’t really messed with it in awhile. Others have incorporated into wordpress plugins and I would assume keeping up with the facebook changes. The links should be in this comment thread.

      Reply
  • November 12, 2012 at 12:45 am
    Permalink

    i have interated you code in my page without word press in php but not showing facebook feed please help me..

    Reply
    • November 13, 2012 at 2:18 pm
      Permalink

      I haven’t updated in my code since someone integrated it into a wordpress plugin. I’m sure facebook has changed a lot since I worked on this code. I have no plans really to look into it at the moment as I have other projects I’m working on.

      Reply
  • November 29, 2012 at 5:36 pm
    Permalink

    Hey. Firstly, thanks for making this and sharing the info with everyone. It’s really useful and works great, even with the latest Facebook changes. I know you’re not planning on working on this project for now, but I was wondering whether there is any way to adjust the image/video size that get posted on the timeline and show in the feed? Most images and videos extend beyond the limits of the feed. Is there any way to make it auto-adjust? Ta.

    Reply

Leave a Reply

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