| 1 |
Drupal for Facebook
|
| 2 |
-------------------
|
| 3 |
|
| 4 |
More information: http://www.drupalforfacebook.org, http://drupal.org/project/fb
|
| 5 |
|
| 6 |
Primary author and maintainer: Dave Cohen (http://www.dave-cohen.com/contact)
|
| 7 |
|
| 8 |
Branch: HEAD (version 2.x for Drupal 6.x)
|
| 9 |
Please read http://drupal.org/node/288721#version and confirm that
|
| 10 |
you are using the correct version.
|
| 11 |
|
| 12 |
Installation and setup documentation now available online
|
| 13 |
http://drupal.org/node/195035. (Read this README.txt first, as it
|
| 14 |
contains the most up-to-date information. Then consult the online
|
| 15 |
documentation for more detailed instructions.)
|
| 16 |
|
| 17 |
To install or upgrade from an earlier version of Drupal for Facebook:
|
| 18 |
|
| 19 |
- Make sure you have an up-to-date PHP client from facebook. You may
|
| 20 |
download a tarball,
|
| 21 |
http://svn.facebook.com/svnroot/platform/clients/packages/facebook-platform.tar.gz,
|
| 22 |
or do this with subversion:
|
| 23 |
svn co http://svn.facebook.com/svnroot/platform/clients/php/trunk
|
| 24 |
|
| 25 |
- If you extract facebook-platform.tar.gz into your modules/fb
|
| 26 |
directory, it should be found automatically. If this is not the
|
| 27 |
case, set a drupal variable, 'fb_api_file', to the location of
|
| 28 |
facebook.php. For example, if you checked the libs out of
|
| 29 |
subversion, add
|
| 30 |
$conf['fb_api_file'] = 'sites/all/modules/fb/facebook-platform/facebook.php';
|
| 31 |
near the end of your settings.php.
|
| 32 |
If you downloaded the bundle, this might work:
|
| 33 |
$conf['fb_api_file'] = 'sites/all/modules/fb/facebook-platform/php/facebook.php';
|
| 34 |
Customize the path above as needed for your installation.
|
| 35 |
|
| 36 |
- If you intend to support canvas pages, install a Facebook-aware
|
| 37 |
theme into one of Drupal's themes directories. One example theme is
|
| 38 |
provided in the 'themes' directory of this module, but Drupal will
|
| 39 |
not find it there. So, you must copy the entire theme directory to
|
| 40 |
sites/all/themes, or another of Drupal's themes directories. Use a
|
| 41 |
symbolic link, rather than copy, if you intend to make no changes
|
| 42 |
and you want updates to be easier. Visit Site Building >> Themes so
|
| 43 |
that Drupal will detect the new theme.
|
| 44 |
|
| 45 |
- Edit your settings.php file (sites/default/settings.php, depending
|
| 46 |
on your install) to include fb_settings.inc (in this directory).
|
| 47 |
For example, add this at the very end of your settings.php:
|
| 48 |
|
| 49 |
require_once "sites/all/modules/fb/fb_settings.inc";
|
| 50 |
|
| 51 |
(Or whatever path is appropriate, could be
|
| 52 |
"profiles/custom/modules/fb/fb_settings.inc")
|
| 53 |
|
| 54 |
See the end of this file for other configuration you may add to
|
| 55 |
settings.php.
|
| 56 |
|
| 57 |
- Enable the Facebook modules via the drupal admin pages, as usual.
|
| 58 |
You must enable at least "DFF Facebook API" and "DFF Applications"
|
| 59 |
modules. You will probably want to enable "DFF User Management" and
|
| 60 |
more of the modules as your App needs them. Enable "DFF Canvas
|
| 61 |
Pages" if you support canvas pages. Enable "DFF Connect" for
|
| 62 |
Facebook Connect features. During development, the "DFF Devel"
|
| 63 |
module is a must.
|
| 64 |
|
| 65 |
- You must enable clean URLs. If you don't, some links that drupal
|
| 66 |
creates will not work properly on canvas pages.
|
| 67 |
|
| 68 |
- Create an application on Facebook, currently at
|
| 69 |
http://www.facebook.com/developers/editapp.php?new. Fill in the
|
| 70 |
minimum required to get an apikey and secret. If supporting canvas
|
| 71 |
pages, get a canvas name, too.
|
| 72 |
|
| 73 |
- Go to Create Content >> Facebook Application. Use the apikey and
|
| 74 |
secret that Facebook has shown you. If you have any trouble with
|
| 75 |
the other fields, use Facebook's documentation to figure it out.
|
| 76 |
When you submit your changes, Drupal for Facebook will automatically
|
| 77 |
set the callback URL and some other properties which help it work
|
| 78 |
properly.
|
| 79 |
|
| 80 |
- If upgrading from an earlier Drupal for Facebook, revisit all of the
|
| 81 |
Facebook Application nodes. Edit each one, look over all the
|
| 82 |
settings as many have changed, especially the choices under user
|
| 83 |
management. You'll have to submit your changes in order for your
|
| 84 |
application to work properly with the new Facebook API.
|
| 85 |
|
| 86 |
Troubleshooting:
|
| 87 |
---------------
|
| 88 |
|
| 89 |
Reread this file and follow instructions carefully.
|
| 90 |
|
| 91 |
Enable the devel module, http://drupal.org/project/devel.
|
| 92 |
|
| 93 |
Enable the "DFF Devel" module and add the block it provides to the footer
|
| 94 |
of your Facebook theme.
|
| 95 |
|
| 96 |
If you see FBML Error (line 62): illegal tag "body" under "fb:canvas",
|
| 97 |
or many "CSS Errors", visit ?q=admin/build/themes. Make sure you see
|
| 98 |
fb_fbml in the list. It is not necessary to enable fb_fml, however
|
| 99 |
you must hit submit (even with no changes) just to get Drupal to
|
| 100 |
refresh its list of where the themes are located.
|
| 101 |
|
| 102 |
If you _still_ see CSS Errors or HTML Errors, most likely the fb_fbml
|
| 103 |
theme is still not being used. This can happen if the theme is
|
| 104 |
initialized before fb.module is initialized. To avoid this, don't
|
| 105 |
have any code that initializes a theme directly in your .module files,
|
| 106 |
put that code in hook_init instead. And if still necessary, lower the
|
| 107 |
weight of the fb module in your system table. See
|
| 108 |
http://drupal.org/node/187868
|
| 109 |
|
| 110 |
If you see "The page you requested was not found." Make sure the
|
| 111 |
canvas page you specified agrees exactly with the canvas page assigned
|
| 112 |
by facebook. Note also that facebook will make all letters lower case
|
| 113 |
even if you typed them upper.
|
| 114 |
|
| 115 |
The Facebook client libraries has bugs if you do not have the JSON extension
|
| 116 |
for PHP installed, see http://us.php.net/manual/en/json.requirements.php. And tell facebook their client libs suck at http://bugs.developers.facebook.com/show_bug.cgi?id=4351.
|
| 117 |
|
| 118 |
Bug reports and feature requests may be submitted.
|
| 119 |
Here's an idea: check the issue queue before you submit
|
| 120 |
(http://drupal.org/project/issues/fb).
|
| 121 |
|
| 122 |
If you do submit an issue, start the description with "I read the
|
| 123 |
README.txt from start to finish," and you will get a faster, more
|
| 124 |
thoughtful response. Seriously, prove that you read this far.
|
| 125 |
|
| 126 |
Here is one way to set up your settings.php. Add the PHP shown below
|
| 127 |
to the very end of your settings.php, and modify the paths accordingly
|
| 128 |
(i.e. where I use "profiles/custom/modules/fb", you might use
|
| 129 |
"sites/all/modules/fb").
|
| 130 |
|
| 131 |
<?php
|
| 132 |
|
| 133 |
/**
|
| 134 |
* Drupal for Facebook settings.
|
| 135 |
*/
|
| 136 |
|
| 137 |
if (!is_array($conf))
|
| 138 |
$conf = array();
|
| 139 |
|
| 140 |
$conf['fb_verbose'] = TRUE; // debug output
|
| 141 |
$conf['fb_actions_verbose'] = TRUE; // more debug output
|
| 142 |
//$conf['fb_debug'] = TRUE; // Output from facebook's API.
|
| 143 |
//$conf['fb_api_file'] = 'facebook-platform/php/facebook.php'; // default is 'facebook-platform/php/facebook.php'
|
| 144 |
|
| 145 |
/**
|
| 146 |
* Enable Drupal for Facebook.
|
| 147 |
* Sets up custom_url_rewrite and session handling required for
|
| 148 |
* canvas pages and Facebook Connect.
|
| 149 |
*/
|
| 150 |
include "sites/all/modules/fb/fb_settings.inc";
|
| 151 |
|
| 152 |
|
| 153 |
?>
|