Extension:Facebook

Facebook Open Graph for MediaWiki allows users to log in with their Facebook account and integrates your wiki into Facebook's Open Graph. Open Graph social plugins can be used on wiki pages, and you can even manage user rights from within Facebook using Facebook Groups.

This extension was not developed by Facebook. The original author is no longer actively maintaining it, however a big push is made once a year to backport bugfixes by the Wikia Development Team and update the extension to the newest standards and protocols as Facebook and MediaWiki both evolve.

As of 2012, development has moved to GitHub. The new project page can be found at github.com/garbear/facebook-mediawiki.

Download
The extension has moved to GitHub. It can be obtained by downloading the ZIP from the developer's GitHub page. Forks of the project can be found by clicking on the Network tab. Additional bugfixes may be found in forks by other users.
 * 1) https://github.com/garbear/facebook-mediawiki

If you would like to obtain an old version from SourceForge, you may check one out via SVN
 * 1) 

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
Note(1/1/12): Tables fbconnect_event_show.sql and fbconnect_event_stats.sql are not used in the latest version. If these tables exist they will be safely ignored.

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.

If you are using a really old version of this extension, you may have to apply this patch.

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.

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.

Further customizing the extension
If you want to have a Facebook Login button on the user login page, you will need to edit the nologin message at MediaWiki:Nologin. Change Don't have an account? $1. to

The extension will automatically fill in scope="auto" with the correct permissions as determined by your configuration parameters or you can specify these explicitly. The permissions can also be modified from within your LocalSettings.php file.

If you have a dark-themed wiki, make sure to add colorscheme="dark" to the login button code. For Special:Connect, you can specify a dark color scheme using the SpecialConnectColorScheme hook.

Facebook Open Graph
By setting $wgFbOpenGraph to true (default) in the newest version, your wiki will be integrated into the social graph. To verify that this process is working, go to the Facebook Object Debugger and insert the link to your main page. If everything works, scroll down to "URLs" and click the link next to "Graph API". What you are seeing here us your Main Page's representation in the Open Graph. Every page on your wiki is now an endpoint in the Open Graph.