Extension:Facebook

What can this extension do?
This is an experimental extension that aims to integrate the newly released Facebook Connect platform into the MediaWiki software.

Status
Currently, this extension is HIGHLY experimental. I am sorry to say it currently has many problems. Seriously, there are too many to list. But it kind of works. Mainly, the Login and Logout buttons don't render properly.

Background
Last month I set up a wiki for my organization at UCLA, and decided to turn to Facebook Connect to incorporate the dynamic privacy and Facebook-publishing features, as we wanted to grant UCLA kiddies special access and also to promote our organization on our users' profiles.

How it works
When you first connect via Facebook Connect, MediaWiki will automatically create a user account named from the user's Facebook ID. The user's real name will be populated by their Facebook name (though the code for this is currently not working), and (eventually) throughout the site their username will be substituted for their real name for aesthetic reasons. If a user account already exists, then this account is automatically logged in. Logging out of Facebook Connect also logs you out of the wiki.

Usage
Integrates Facebook Connect into MediaWiki software.

Download instructions
Please cut and paste the code found below and place it in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php: Configuration parameters can also be set in LocalSettings.php (see the following section).

Configuration parameters
This extension's configuration parameters are defined in FBConnectConfig.sample.php. In production, this file should be renamed to FBConnectConfig.php. The following configuration variables can either be set in FBConnectConfig.php by modifying their default values, or overridden by defining them in LocalSettings.php.

$callback_url
Enter your callback URL here. That's the location where index.php resides. Make sure it's your exact root - facebook.com and www.facebook.com are different.
 * Default value:  - Change this!

$api_key
Get the API key and secret from http://facebook.com/developers. Note that each callback URL needs its own app id. Set the callback URL in your developer app to match the one you chose above. This is important so that the Javascript cross-domain library works correctly.
 * Default value:  - Change this!

$api_secret

 * Default value:  - Change this!

$base_fb_url
This is the root of the facebook site you'll be hitting. In production this will be facebook.com. However, Facebook Connect has now been released and changing this value seems to invalidate the code. Maybe in the future?
 * Default value:

$feed_bundle_id
The feed story template needs to be registered with your app_key, and then just passed at run time. To register the feed bundle for your app, visit http://www.yourwiki.com/path/to/extensions/FBConnect/register_feed_forms.php
 * Default value:  - Change this if you're brave enough to register a form feed, I definitely am not.

$wgFBConnectOnly
Set this to false to allow users to continue logging into your site with old-style user names.
 * Default value:

$wgRemoveUserTalkLink
Set this to true to remove the link to a user's talk page in the personal toolbar (the menu in the upper right).
 * Default value:  (for now)

$wgFBConnectLogoUrl
Location of the 16x16 Facebook logo. You can copy this to your server if you want. It replaces the user icon that currently appears in front of our user name.
 * Default value:  - Can also be set to

$wgShowIPinHeader
This value will automatically be set to  in FBConnectConfig.sample.php. It removes the link to the user's IP address when they are not logged in, so that only the Facebook Connect logo will be displayed. See Manual:$wgShowIPinHeader.

SVN Access
I hope to upload these files to SVN, because they need some major contributions.

List of files

 * 1) FBConnect/FBConnect.php
 * 2) FBConnect/config.sample.php
 * 3) FBConnect/FBConnect.alias.php
 * 4) FBConnect/FBConnect.i18n.php
 * 5) FBConnect/fbconnect.js
 * 6) FBConnect/FBConnectAuthPlugin.php
 * 7) FBConnect/FBConnectClient.php
 * 8) FBConnect/FBConnectHooks.php
 * 9) FBConnect/register_feed_forms.php
 * 10) FBConnect/SpecialConnect.php
 * 11) FBConnect/xd_receiver.php

Facebook PHP Client Library
Download at http://svn.facebook.com/svnroot/platform/clients/packages/facebook-platform.tar.gz, or copy/paste the code from the following files.
 * FBConnect/facebook-client/facebook.php
 * FBConnect/facebook-client/facebook_desktop.php
 * FBConnect/facebook-client/facebookapi_php5_restlib.php
 * FBConnect/facebook-client/jsonwrapper/jsonwrapper.php
 * FBConnect/facebook-client/jsonwrapper/jsonwrapper_inner.php
 * FBConnect/facebook-client/jsonwrapper/JSON/JSON.php
 * FBConnect/facebook-client/jsonwrapper/JSON/LICENSE
 * FBConnect/facebook-client/jsonwrapper/JSON/JSON.php
 * FBConnect/facebook-client/jsonwrapper/JSON/LICENSE
 * FBConnect/facebook-client/jsonwrapper/JSON/LICENSE

Files I have deleted / renamed

 * 1) FBConnect/FBConnect_body.php
 * 2) FBConnect/FBConnectAutoAuthenticate.php
 * 3) FBConnect/FBConnectConfig.sample.php
 * 4) FBConnect/FBConnectCore.php
 * 5) FBConnect/FBConnectInit.php
 * 6) FBConnect/FBConnectPersonalUrls.php
 * 7) FBConnect/FBConnectSetup.php