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.

Upgrading

 * Version 4.0 (2012) has been updated to support Facebook Open Graph. Please read through config.default.php for an explanation of new features.
 * After upgrading, visit Special:Connect/Debug to make sure your Facebook application is configured correctly.
 * 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.
 * 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.

Configuration
The file config.default.php (here) 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.

User login form
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.

Facebook permissions
The FacebookPermissions hook allows you to specify the permissions required by your application explicitly. For more info, see Facebook permissions. The hooks below can be placed directly in your LocalSettings.php file.

Note that if you previously requested offline_access, this permission will be removed from Facebook on May 1, 2012. See the annoucement here.

Social plugins
XFBMLAvailableTags</tt> provides an array of available social plugins (see Social plugins and Open Graph beta social plugins). Specific social plugins can be blacklisted. If a new plugin becomes available that this extension does not yet support, it can be added via this hook. View the default list of plugins in FacebookXFBML.php. You can disable all plugins using the $wgFbSocialPlugins</tt> configuration parameter.

Social plugins color scheme
XFBMLSkinColorScheme</tt> can be used to automatically theme social plugins based on your site's various skins. This hook causes social plugins to automatically include the colorscheme="dark"</tt> parameter on dark-themed wikis. You can override this on a per-plugin basis by explicitly specifying colorscheme="light"</tt> in your page's wiki text. The color scheme is determined by the skin of the user saving the page; if you have multiple light/dark skins, install Extension:MagicNoCache and include __NOCACHE__ on the pages with social plugins.

Facebook Open Graph
By enabling $wgFbOpenGraph</tt> in the newest version, your wiki will be integrated with Facebook's Open Graph. Every page now has its own Open Graph ID used to publish actions on users' Timelines. To verify and check for problems, use the Object Debugger on Special:Connect/Debug</tt>.

Note: These features are still in development and are not activated yet in the current version on GitHub (4.0-beta, Jan. 20).

Social integration
This extension also allows you to define custom Open Graph objects. Custom objects allow your wiki to more deeply integrate into the social graph. For example, let's say the Star Wars wiki registered the "spaceship" object on Facebook and included the tag  </tt> on the Millennium Falcon page (http://starwars.wikia.com/wiki/Millennium_Falcon). Now, in the Open Graph, this url represents a spaceship instead of an article.

Custom actions allow your users to interact with objects in creative and meaningful ways. In the example above, let's say the Star Wars wiki defines the "drive" action in the Open Graph Dashboard and connects it to the spaceship and landspeeder objects, and then specifies the relationship in LocalSettings.php:

When this action-object connection is made, the user's private activity log (and maybe their friends' new feeds) will say "User drove the Millennium Falcon," with a link to the wiki page. Assuming you define some Aggregations, a Timeline View for your app will be visible at the top of the user's Timeline. When sufficient connects are made, the user's Timeline will feature a Report showcasing their interactions with your app.

Custom actions
The  </tt> tag is used to define custom objects and actions. To set up the extension, you must first define your action-object connections in your Facebook application's Open Graph Dashboard and then register them with the $wgFbOpenGraphCustomActions</tt> parameter:

Actions can be placed in your wiki using the  </tt> tag:  Drive the ! </tt>. This will render a link that, when clicked, adds the activity to the user's Timeline.

Advanced Open Graph integration
The  </tt> tag is used for social markup and rendering action buttons. There are five properties inherent to all articles and custom objects: type</tt>, title</tt>, locale</tt>, image</tt>, and <tt>description</tt>. These properties are set automatically, but can be overriden: Custom objects defined in the Open Graph Dashboard can use additional properties, if any have been defined. If the <tt>action</tt> attribute is specified, the text inside the tag will be parsed and used as a link for initiating the custom action. An object's definition and an action link can be combined using the same tag. Note that you must first register the action connected to the object and define the relationship using <tt>$wgFbOpenGraphCustomActions</tt>. Custom objects can be integrated into most wikis with very little effort. If your wiki uses infoboxes or other categorical templates, include the <tt> </tt> tag in the template. Page: Millennium Falcon

Page: Template:spaceship_infobox

<opengraph type="spaceship" title="" image="" />

Advertising
If your wiki monetizes advertising, action specs can be used in ad targeting to reach out to people based on their actions. For more information see: https://developers.facebook.com/docs/reference/ads-api/action-specs-custom/