Extension:Facebook

The Facebook Platform for Websites enables you to make your wiki more social. With this extension installed, users can log in with their Facebook accounts and access other features provided by this extension.

This extension was not developed by Facebook. The original author is no longer actively maintaining it, however the bugfixes (a list of which is here) by the Wikia development team are backported by the author once a year.

Convenience
Forget remembering usernames and passwords across a broad array of sites. Also, if permission is given, then this wiki can even use Facebook as an email proxy so you can continue to receive important notifications without revealing your email address.
 * "Single Sign On" experience via Facebook Connect
 * On a successful Connect, allows the user to choose a nickname and creates a new account for that user on the wiki
 * Updates the wiki user's information from Facebook upon login (opt-out soon to come)
 * Logging out of Facebook logs you out of the wiki and vice versa

Facebook Markup Language
Facebook has provided a bunch of built-in tags that will render dynamic data. Many of these tags can be included in wiki text, and will be rendered differently depending on which Connected user they are being viewed by.

XFBML in wiki text is enabled by default. Non-secure tags and attributes are excluded from the final page output. Due to a bug in MediaWiki, the facebook-logo attribute of  is also dropped from the final page output. Applying the patch posted to this bug report resolves this error. Hopefully the patch will be included in MediaWiki's code in the future.

If XFBML is enabled, then  maybe be used as an alternative for $wgAllowExternalImages with the added benefit that all photos are screened against Facebook's Code of Conduct and subject to dynamic privacy.

Tags that work

 * Activity Feed 
 * Comments 
 * Facepile 
 * Like Button 
 * Live Stream 
 * Login with Faces 
 * Recommendations <fb:recommendations></fb:recommendations>

Tags that don't work
Works now for me! Just use <fb:like-box href="http://www.facebook.com/name">
 * Like Box <fb:like-box profile_id="185550966885"></fb:like-box>

Communication
Facebook Connect ushers in a whole new level of networking. See which of your friends are using the wiki, and easily publish articles to the Social Graph and the Stream.

Download
The extension has moved to GitHub. It can be obtained from the original developer at https://github.com/garbear/facebook-mediawiki. Additional bugfixes may be found in forks by other users.

If you would like to obtain an old version from SourceForge, you may use one of these links.
 * 1) Download SVN files via SourceForge tarball
 * 2) Browse the source code
 * 1) Browse the source code

Installation
First, like any extension, you will need to place the folder containing the PHP source files into the extensions folder of your MediaWiki installation. Make your wiki aware of the extension by including it in your Localsettings.php.

Database update
Your database will need to be updated to work with Facebook. This process will probably be made much simpler for MediaWiki 1.17, but until then the update must be done from the command line. It will only work with PHP 5. Some web servers still default to PHP 4, which you can check using the following command:

$ php --version PHP 5.2.15 (cli) (built: Dec 15 2010 14:09:31)

Assuming PHP 5, run MediaWiki's update script.

$ cd path/to/site/w/ $ php maintenance/update.php

Fixing Database prefix problems
If you use a database prefix, the maintenance update script may fail. In that case, add your database prefix to the file-names in the folder /extensions/Facebook/sql to the following files: fbconnect_event_show.sql fbconnect_event_stats.sql user_fbconnect.sql and run the maintenance/update script again.

You may notice that your facebook extension is still not functional. When going to special pages -> Log in with Facebook, you get a database error, where you can observe that you have a duplicated database prefix. To fix this, edit the file extensions/Facebook/FacebookDB.php, and find the function getPrefix around line 212. Modify the return value as follows: return self::sharedDB ? $wgSharedPrefix : ""; // bugfix for $wgDBprefix; This should eliminate your double prefix issue.

Alternatively, if you are checking out via SVN or GitHub, updating to any revision above r404</tt>/48d16dd</tt> (Mar 7, 2011) will contain this fix.

Configuration
The file config.default.php contains the steps for creating a new Facebook application and different ways to customize your setup. You may edit config.default.php directly, but in order to preserve changes across updates it is recommended that you save the modified file as config.php. Alternatively, you may include your settings in Localsettings.php after the  statement above.

It is highly recommended that you enable the "Remember my login" option by default so that the user doesn't have to go through the Facebook login process each time.

Upgrading

 * Take care upgrading from older versions of this extension (from r91, pre-March 2010). Unfortunately, due to the new database layout, backwards compatibility was unable to be retained and considerable user renaming might have to be done. Updating from r100+ is safe and recommended.
 * When updating from an older version, consider bumping $wgStyleVersion.
 * Note that if you are using a version from 2011 (v3.0+), the name of the extension folder has changed from "extensions/FBConnect" to "extensions/Facebook". Simply overwriting the files in the old directory won't work because some JavaScript and CSS paths are hard-coded.