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 Comments:

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

  2. 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.

  3. 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?

    • 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.

  4. 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.

    • 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.

  5. 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.

    • 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.

      • 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

        • 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.

  6. 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!

  7. 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.

  8. Ok, so I’ve actually started writing this as a plugin.

    I’m having some issues though. right now I’m setting up permissions and I set the URL on facebook so your link isn’t valid(returns error 191) So I put it on my page.
    What was returned was :http://graphicnerdery.com/set_access.php?code=XXXXXXX&state=XXXXXX
    with a long string on both. Also, I did not get the JSON output like you did.

    • 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.

      • 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

  9. 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.

    • 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

  10. 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

    • 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

      • 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

    • 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.

  11. 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

  12. strangest thing – the set access feed works fine http://www.junioraspirin.com/set_access.php
    but then when the facebook box comes up blank
    obviously i am being stupid
    http://www.junioraspirin.com/feed.php
    any ideas?

    • 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.

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

  13. 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

    • 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!

      • 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.

  14. 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

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

  16. 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?

    • 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.

  17. 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

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

    • 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.

  18. 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

  19. 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?

    • 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.

  20. 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() ?

    • 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.

      • Did you find out anything?

        • 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.

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

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

          • 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?

          • 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’);

          • 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.

        • 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();

          • 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?

          • 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.

          • 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.

          • 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…

          • 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

          • 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.

          • 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?

          • 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.

          • 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.

          • 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 :)

          • 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…

          • 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!

  21. 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?

    • 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.

  22. 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.

  23. Hi Fedil, I did everything as you instructed for version 0.9.5, including creating the extra “fb_access_token.txt” file. My “set_access.php” script pulled all the info from my wall correction. However, the box is void of content – see this link:

    http://tuckersdoggiedelights.com/

    My facebook wall I’m trying to display is a fan page, at the following url:

    https://www.facebook.com/tuckersdoggiedelights

  24. Thanks Fedil – will look forward to hearing from you.

  25. 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

  26. Is it possible to relink – cannot locate the php file you linked

    Daniel W
    September 30th, 2011 – 05:37
    The links to the files were not parsed, here they are:
    http://danielwestergren.se/uki_facebook_wall_feed/uki_facebook_wall_feed_v0.9.6.php
    http://danielwestergren.se/uki_facebook_wall_feed/uki_facebook_wall_feed.css

  27. 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.

  28. 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.

    • 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.

      • 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.

  29. 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?

  30. 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 !

  31. Here is a wordpress plugin we wrote that will display facebook group feed like wall posts! Easy to use and better than anything out there!

    http://www.slickremix.com/product/jal-facebook-group/

  32. 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

    • 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.

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

    • 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.

  34. 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.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>