Posting to your Facebook wall as user or post to Facebook fan page as admin

Let's first install Drupal for Facebook module as it's stated in readme file.

1.First download and install FB PHP-SDK, download from http://github.com/facebook/php-sdk. Extract the files, and place them in sites/all/libraries/facebook-php-sdk on your site

2.Your theme page.tpl.php and others need the following attribute at the end of the tag: xmlns:fb="http://www.facebook.com/2008/fbml"

3. Add this 2 lines to end of your settings.php include "sites/all/modules/fb/fb_url_rewrite.inc"; include "sites/all/modules/fb/fb_settings.inc";

4. Then install this module and enabled needed submodules for your needs. In this case they are "FB streams", "FB User Management", "Facebook API", "Facebook Apps", "Facebook Connect", "FB Example Customizations", latest "example customizations" module in fact consists of option to put node you publish also to your facebook profile.

When all this is done, you need to find on Facebook a link to create aplication on facebook, good luck with that :-)
After you do this Go to Administer >> Site Building >> Facebook Applications and click the Add Applicaiton tab. Use the app id, apikey and secret that Facebook has shown you. Hopefully other settings will be self-explanitory. When you submit your changes, Drupal for Facebook will automatically set the callback URL and some other properties which help it work properly.Important for this to work is that you enable submodules previously mentioned and configure all FB in drupal accordingly to your needs. So much modules for such a small feature :-) this will give you out of the box posting to your profile wall, if you want to post to your facebook fan page you need to add to function fb_example_nodeapi a line with actor_id number of your app(get id number from fb app info, or just click edit app and get it from url as id) like below


fb_stream_publish_dialog(array(                                 'actor_id' => '101457763262687',                                 'attachment' => $attachment,                                 'action_links' => $actions,      ));

After all that if you want to add image to your FB post from your current post, go to previously created post on this site here.