How to post from your Drupal site to a Facebook page (as the page admin) in under 10 steps!How to post from your Drupal site to a Facebook page (as the page admin) in under 10 steps!

! NOTICE ! Facebook have depreciated their old SDK that powered the Drupal for Facebook functionality discussed in this post, so at present, this will not work. We will be updating the how-to shortly to take account of the new API and with a Drupal 7 example ! NOTICE !

So, with scant documentation on this very important piece of functionality I thought I'd post a 'how to' on this one - you want to automatically push content from your Drupal site, into a Facebook wall, fan page or company page, and you want to do this as the page itself rather than as your user?

Here goes...

1. Create a plain Facebook application.

Head to and create an application with bare minimum details.

The icon you upload will be the icon that appears at the base of each Facebook wall post, beside the details. The profile image you upload will appear on the application page.

Make note of your 'App ID' and your 'App Secret'.

2. Install Drupal for Facebook.

In the normal manner, downloading, unpacking and putting in your modules directory.

3. Download and install the Facebook SDK.

Be sure to dowload a version earlier than 3.0 as the latest versions are not compatible. We have had the most joy with the 2.2 version.

You will need to place the unzipped 'src' directory so that the directory structure looks like :-

/sites/all/libraries/facebook-php-sdk/src/ and then the individual files.

4. Enable and configure Drupal For Facebook in Drupal.

Got to your Site Building -> Modules -> List and enable all the Drupal for Facebook modules.

You will also need to enable the Facebook Extended Permission module in the Drupal for Facebook - Contrib modules fieldset.

You need to add 'xmlns:fb=""' at the end of your theme's opening html tag. So, it will look something like :-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" xml:lang="<?php print $language->language; ?>" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?> xmlns:fb="">

You need to add these two lines to the bottom of your settings.php file

include "sites/all/modules/fb/";
include "sites/all/modules/fb/";

Or, depending where you install your modules, this might be

include "modules/fb/";
include "modules/fb/";

All of these settings (step 4) are in the readme.txt in the root of the directory of the Facebook module, if stuck, that's your first stop!

5. Create Your Application in Drupal for Facebook

Head to Site Building -> Facebook Applications -> Add App.

Fill out a label, put in your previous App ID and App Secret, ensure 'enabled' is ticked.

Under 'Facebook Extended Permissions -> Required Extended Permissions', tick the boxes for 'Offline Access', 'Publish to my Wall' and 'Manage Pages'.

Under 'Facebook Connect' ensure that the Primary checkbox is ticked.

Save the application.

6. Link your application to Facebook Connect.

Head to Site Building -> Facebook Applications -> Facebook Connect

From the dropdown, select your new application and save.

7. Connect your Drupal account to your Facebook account.

You will need to place the Facebook Connect block somewhere you can get at it, so head to Site Building -> Blocks > List and place the Facebook Connect block in footer or right sidebar (depending where you want it).

Then, when logged in as the account you wish to link (I use the admin account), click on the Facebook Connect icon and then login to Facebook on the popup allowing the application access.

Double check at this point that all the things you ticked in 'Extended Permissions' are showing, if they are not, if it is just 'access my basic information', then you need to go back and edit the app to enable the extended permissions mentioned in step 5.

8. Install and configure your custom Facebook Wall Post module.

This is the tricky part where many people fall over. The documentation is sketchy and out of date with conflicting instructions based on different versions of Facebook requirements.

Download and enable your custom Facebook Wall Post module (example at base of this article).

I have included a sample module that will do the job at the bottom of this post. You will need to head to the Drupal menu item - 'Site Configuration -> Facebook Wall Post' to set your configuration items.

If you wish to post custom media types (images/videos/etc) please look in the attachments section of the module code and program accordingly.

If you wish to post on the page wall as yourself, or, on your own wall, please look at the configuration page and set the target_id and user_id accordingly.

You may also wish to restrict which types of content are posted to Facebook, you can do this on the configuration page.

9. Install the application into your Facebook page.

Head to the application's page, you can see this by clicking on 'about' in Site Building -> Facebook applications -> List on your app, or simply go to

When on the application page, click on 'Add to My Page' on the left-hand menu, select the page. And close.

This will add the application to your page and a tab, you don't really need the tab. So, I would head to your fan/company page, edit the page, apps, and then 'remove the tab' from the application settings.

You're now ready to post to Facebook!

A 'share on Facebook' link will appear on each post you make, if it's ticked, it will background post to your wall as the wall!

fb_wall_post.zip2.96 KB


example module?

Hi there,

I can't seem to find the example module you mention in the text...

Hi, It is at the base of the


It is at the base of the post - directly above the Comments section, the section marked 'Attachment'.


thank you


Thank you, i think i was kinda tired because i dident saw it :)

I got it now, thank you for

I got it now, thank you for the great text..

But there is a problem, when i submit a node, it says:

"Fatal error: Call to undefined method Facebook::getSession() in C:\wamp\www\drupal\sites\all\modules\fb\contrib\fb_wall_post\fb_wall_post.module on line 142"

You can find a patch regaderding this issue here;

thanks, is there a way to contact you direcly? because the captache here does not like me...

Hi, That error usually means


That error usually means you are using the latest version of the Facebook SDK, the Drupal for Facebook module is not compatible with this yet. Check Step '3' again - try using the SDK version 2.2.

I'm contactable on


module update?

any chance to get an updated version of this module for implementation with the latest Facebook PHP SDK? (3.1.1)

it would greeeeeaaaaatly appreciated!

We will definetly be doing it

We will definetly be doing it in the future, but can't give a timeframe currently I'm afraid :( Client-work takes priority!

is this for drupal 6 only?

im using drupal 7, hope there is a way to implement it in drupal7

Drupal 7


This solution is for Drupal 6, we haven't yet fully embraced 7 (waiting for the modules to build up!) so for now, this just applies to 6 :)


This saved me a ton of time.

This saved me a ton of time. Thank you!

post to fanpage

i want to post to "fan" page, but i cant do it. all of post is done to my facebook main page.

Drupal 7

I need it for D7 too. Has anyone done this? greets

Facebook Wall Post module for D7

path to donload it:


I followed your steps.Need yor help.
I am getting the like and send button but not the share button...

Drupal 7

need it also for D7... would be highly appreciated!

no old 2.2 version to download

Sorry, there is no dowload-version earlier than 3.1 on the SDK-download-site. Please, can you check this.

no 2.2 version on sdk-download site

There is no 2.2 version on sdk-download site. Please, can you check this.

Drupal 7 needed..

is this ported to D7 yet??

Facebook Wall Post module for D7

Path to download it:-

Found this for D7

Found this for D7

Automatic Send


I create nodes in Facebook using Feeds and I would like these Feed Items (nodes) to be automatically send to a Facebook wall upon creation, but at the moment I have to manually check the "Post to Facebook" box when editing. Is there a way round this so that I don't have to do this manually?

Thanks in advance


Hi, you would need to tap

Hi, you would need to tap into a hook, not something we've had to try at the moment. In the meantime, you could look at :- which automatically feeds to your Facebook wall periodically, we've used this on a couple of sites already.

Post new comment