Last updated November 9, 2015. Created on November 24, 2007.
Edited by charginghawk, sobi3ch, EvanDonovan, jaypark. Log in to edit this page.

What is Drupal for Facebook?

Drupal for Facebook is a suite of modules supporting Facebook's social plugins, and allowing you to host Facebook applications.

What can Drupal for Facebook help you do?

  • Add Like buttons, and other social plugins to your Drupal-powered website.
  • Let users authenticate to your site using their facebook username and password. This saves the user the trouble of registering with your site, and allows you to build additional social features, known as Facebook Connect.
  • Create applications on facebook.com. Powered by your Drupal server, these applications add features and content for your users while they visit facebook.com.
  • Publish content from your site to a user's Facebook stream (wall).
  • And more!

Additional Resources

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

edemicity’s picture

I need a step by step help on how to setup fb module. I have gone through all the setting but I still have this error message "Drupal for Facebook has been enabled, but fb_settings.inc is not included in settings.php. Please read the README.txt."

kshankin’s picture

Have you checked the README that's located inside the modules folder? I'm about to install and setup this module myself and the README seems to have the information that's needed.

If I get hung up anywhere, I'll let you know so that we can figure it out

***UPDATE***

Ok, I've installed the module and set it up, as long as you follow the instructions in the README.txt that is saved inside the modules folder, you will be fine. It's actually pretty straightforward.

The only thing that hung me up for a second was the fact that it took the facebook servers about 10 min before my app had integrated throughout, so I wouldn't necessarily create the app from your drupal website for about 10 min after installing all necessary modules, creating your developer profile, and adding your app to facebook from their end.

edemicity’s picture

I was able to installed in successful, but the problem is, I can't post to my facebook fan page, how to add like and share button on my node.

my urls has change, facebook API has been added to it and it does not permit me to access some administration page, it keeps saying "Access Denied"

I look forward to hear from you.

Thanks

realrudymartin’s picture

My understanding is there is a limit of 5000 friends and the fans page can be much larger than that.

edglazer’s picture

Howdy, I'm a huge fan of this module, Dave, so thanks so much for all the hard work.
One thing, it took me a while to track down the source of this error:

Fatal error: Call to undefined method Facebook::getSession() in /.../networknorms.org/sites/all/modules/fb/fb.module on line 193

was because I had the latest facebook-php-sdk (3.01 at the time of this writing), when php-sdk v2.1.1 or 2.1.2 are required. I eventually found the issue queue here:
http://drupal.org/node/1166272
which is for the 6.x branch, where the last message said that a fix was in the readme.txt - whereas I didn't see anything in the 7.x README that indicated I needed facebook-php-sdk version 2.x. I just cross-posted there, but in case it's helpful, I'm posting here as well. Not meaning to spam, I'm just new to Drupal so I don't know the practices about where best to report issues and so on. As I said before, many thanks for the great module!

jerdiggity’s picture

Please note that Facebook has (again) changed the structure of things so that now there is no API key issued when a new app is created (or so it would appear). That said, if you're getting confused about where to get your API key from, what to enter in the API Key box, etc., it looks like they've simply merged API Keys and App IDs into one big ball of... "fun".

So, when you're setting up an app from within Drupal and you're prompted to enter your app's information (Facebook App ID, API Key, and Secret), whatever you put in the Facebook App ID box should also go into the API Key box as well -- i.e. the two values should (now) be identical. See this image for an example.

Just a heads-up.

:)
jeremy

---
Yo that's shizzle.

mubiesam’s picture

I'm not sure which one to pick, seems both support fb social plugin, can any one give me a hint...

Thanks,
Sam

Enjoy with me...

youngbac’s picture

I am not an expert on Drupal, but i have tried both of them and I am very happy with the fb modul.
Everything is working quite well.

Alex

youngbac’s picture

Hello all together,

first I want to mention that I'm very happy with the modul, but I now have a question:
Is there any posibility to provide facebook comments like this:
http://developers.facebook.com/docs/reference/plugins/comments/ with the module?

I have tried it different ways, but nothing worked well.

Thanks for your help!

Alex

nazirhussain’s picture

1. Install the

fb

module and all its dependencies

2. add the below piece of code at the ned of "sites/default/settings.php"

/**
 * Drupal for Facebook settings.
 */

if (!is_array($conf))
  $conf = array();

$conf['fb_verbose'] = TRUE; // debug output
//$conf['fb_verbose'] = 'extreme'; // for verbosity fetishists.

// More efficient connect session discovery.
// Required if supporting one connect app and different canvas apps.
//$conf['fb_id'] = '123.....XYZ'; // Your connect app's ID goes here.

// Enable URL rewriting (for canvas page apps).
include "sites/all/modules/fb/fb_url_rewrite.inc";
include "sites/all/modules/fb/fb_settings.inc";

// Header so that IE will accept cookies on canvas pages.
if (!headers_sent()) {
  header('P3P: CP="We do not have a P3P policy."');
}

// end of settings.php
MadDrupal’s picture

I am not sure if this is the right place to ask the question but I have to start somewhere. I discovered that when I post to wall, the wall post has errors in formatting. Essentially the content that needs to be published is not correct.

Where in the module is the code that collects the data and posts it to Facebook wall? Can you guys give me some guidelines on how to tackle this?

hallswah’s picture

Hi Guys,

I am trying really hard to follow the documentation for the install of this, but am getting stuck here:

- Your theme needs the following attribute at the end of the tag:

xmlns:fb="http://www.facebook.com/2008/fbml"

Drupal 7 should include this by default. Use your browser's view source feature to confirm.
If not, you may need to edit your theme's html.tpl.php file. See
http://www.drupalforfacebook.org/node/1106. Note this applies to
themes used for Facebook Connect, iframe Canvas Pages, and Social
Plugins (i.e. like buttons). Without this attribute, IE will fail.

Note that some documention on facebook.com suggests
xmlns:fb="http://ogp.me/ns/fb#" instead of the URL above. Try that
if the above is not working for you.

I checked the page source and it appears that the above is not present.

After following the urls suggested I am no closer to finding out where exactly this piece of code goes.
I have tried asking elsewhere for help but cant get any so far - does anybody have clear instructions on where this extra code needs to go?

Any help here is much appreciated, thank you.

Yuri’s picture

Good question hallswah, I would like to know the same. Seems to me super-vague.

Sally Gruger’s picture

I'm having the same problem. I found /modules/system/html.tpl.php, which has the full doctype statement, but I am unsure of how to move it to a sub-theme. Also, when I read the page source code, all it has is an html5 doctype declaration, where there is no namespace info.
So, I too am confused about this.
I appreciate the author's hard work but there needs to be some more documentation on this.

jerdiggity’s picture

Here's where the code needs to go:

Before:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"  "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" version="XHTML+RDFa 1.0" dir="ltr"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:dc="http://purl.org/dc/terms/"
  xmlns:foaf="http://xmlns.com/foaf/0.1/"
  xmlns:og="http://ogp.me/ns#"
  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xmlns:sioc="http://rdfs.org/sioc/ns#"
  xmlns:sioct="http://rdfs.org/sioc/types#"
  xmlns:skos="http://www.w3.org/2004/02/skos/core#"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
<head profile="http://www.w3.org/1999/xhtml/vocab">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>My Cool Site</title>
</head>
<body>
  <div><p>Welcome to My Cool Site.</p></div>
</body>
</html>
After:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"  "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" version="XHTML+RDFa 1.0" dir="ltr"
  xmlns:fb="http://www.facebook.com/2008/fbml"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:dc="http://purl.org/dc/terms/"
  xmlns:foaf="http://xmlns.com/foaf/0.1/"
  xmlns:og="http://ogp.me/ns#"
  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xmlns:sioc="http://rdfs.org/sioc/ns#"
  xmlns:sioct="http://rdfs.org/sioc/types#"
  xmlns:skos="http://www.w3.org/2004/02/skos/core#"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
<head profile="http://www.w3.org/1999/xhtml/vocab">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>My Cool Site</title>
</head>
<body>
  <div><p>Welcome to My Cool Site.</p></div>
</body>
</html>

Also, please note that if you want to add a custom html.tpl.php to your theme, you should be able to simply copy the default one from /modules/system/html.tpl.php and place the copy into your theme's directory. Or you can create your own blank one and then place the code from the example below inside it. Doing so should automatically make Drupal recognize the new html.tpl.php file, but you'll need to clear the cache before the system will see the file.

Further note that the example I gave above was from a site where the RDF module is enabled. If your site does not have that module enabled (it comes with Drupal core), then your site's HTML source code will probably be a little shorter than the example.

Regardless, here's an example of what you could put into your custom html.tpl.php file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"  "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" version="XHTML+RDFa 1.0" dir="<?php print $language->dir; ?>" xmlns:fb="http://www.facebook.com/2008/fbml"<?php print $rdf_namespaces; ?>>
<head profile="<?php print $grddl_profile; ?>">
  <?php print $head; ?>
  <title><?php print $head_title; ?></title>
  <?php print $styles; ?>
  <?php print $scripts; ?>
</head>
<body class="<?php print $classes; ?>" <?php print $attributes;?>>
  <div id="skip-link">
    <a href="#main-content" class="element-invisible element-focusable"><?php print t('Skip to main content'); ?></a>
  </div>
  <?php print $page_top; ?>
  <?php print $page; ?>
  <?php print $page_bottom; ?>
</body>
</html>

Once the file has been saved inside your theme's directory, clear the cache by navigating to admin/config/development/performance and clicking the Clear all caches button.

Hope that helps...

:)

---
Yo that's shizzle.

Sally Gruger’s picture

I haven't been here in a while so just found your reply.
Thank you. It worked. Now on to the rest of the installation to see if everything else goes OK.