Facebook Connect Plugin for MediaWiki

From Facebook Developer Wiki

Jump to: navigation, search

Image:mediawiki.gif This article describes how to integrate Facebook Connect into your MediaWiki installation. MediaWiki is a free software wiki package originally written for Wikipedia. Because its documented API allows for the use of extensions, it is relatively simple to incorporate Facebook Connect integration.

For the newest updates, please see Extension:FBConnect at MediaWiki.org.


Contents

Status

As of February 11, the developer has taken a break to focus on college midterms and finals. Development will resume over summer (end of June). If anyone would like to pick up the slack until then, go crazy! Feel free to email the developer at gbruin (at) ucla (dot) edu.

The FBConnect extension for MediaWiki replaces the login functionality with Facebook Connect. This extension was developed on MediaWiki 1.14alpha. Backwards compatibility with MW-1.13.3 is unverified/untested, but might still work. This extension is in beta (though relatively stable), and still requires much testing. Speaking of which...

I need help testing and developing! I have set up a SourceForge repository for this extension. If you can contribute anything (code, patches, ideas, error messages & circumstances surrounding those errors) then let me or Arjun Banker know.

Oh wait, this is a wiki... just hit that little [edit] button up in the corner and scribe it here!

Features

  • "Single Sign On" experience via Facebook Connect
  • On a successful Connect, creates a new wiki user and fills in Real Name from Facebook
  • The form of the created user name can be defined by $fbUserName
  • Logging out of Facebook logs you out of the wiki and vice versa
  • Links to Facebook Connect user pages are distinguished by a Facebook icon
  • Account merging functionality (soon to come)
  • And more...


Special:Connect

This special page gives the user the choice of using Facebook Connect or logging in with a wiki account. If the user logs in with an account on the wiki, they will have the option to Connect their account with Facebook. When this feature is finished, it will allow existing wiki users to merge their account with Facebook Connect. Until then, to merge existing users into new Facebook Connect accounts see Extension:Renameuser or Extension:User Merge and Delete. When Connected, the special page looks like this: Special:Connect.


User Rights from Facebook Group

Instead of using the built-in special pages to manage user rights, this extension enables users to manage rights using a Facebook group. By simply creating a group and providing the group ID, Connected users will automatically be promoted to any of three implicit groups:

  • Group member: This right will be attached to people belonging to the Facebook group or "awaiting reply."
  • Group officer: Making someone an officer of the group will automatically give them Bureaucrat rights.
  • Group admin: Likewise, admins of the Facebook group will inherit Sysop rights on the wiki.

A fourth group is also provided: Facebook Connect user. As is evident from the Mouseover ToolTips, all accounts created by Facebook Connect belong to this group.


Mouseover Tooltips for Connected Users

Seven random numbers were way too fugly and it was impossible to keep track of who was who. Using the Tooltips with JavaScript library, Facebook-styled DHTML tooltips display info about the user you are mousing-over. Currently, profile pics and the real name are displayed for Connected users. Eventually, these tooltips will be modified to contain additional information (perhaps nickname, Facebook networks, other info or group membership). For an illustration, see the extension's main page at MediaWiki.org.


XFBML

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 <fb:profile-pic> 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 <fb:photo> maybe be used as a replacement for $wgAllowExternalImages with the added benefit that all photos are screened against Facebook's Code of Conduct and subject to dynamic privacy

Note: previously a security vulnerability was present in this feature due to onclick attributes. As such, this feature was originally intended for internal wikis only. This was not actually a security hole in XFBML. XFBML markup is on the page of the MediaWiki site, not on Facebook's page as was the case for FBML. The worst that could have happened is that a malicious user could have imitated another user on the wiki. In no way can the other user's Facebook account be compromised. This issue is now confirmed to be fixed.


Coming Soon (probably in this order...)

  • Incorporate account merging functionality
  • Proxied Email instead of requiring users to enter an email
  • Entire preferences tab overhaul (This may suck to code)
  • Publish Feed story dialog when saving a wiki page (opt in or a PHP setting)


Download

You are always better off with the most recent SVN release:

  1. svn co https://fbconnect4mw.svn.sourceforge.net/svnroot/fbconnect4mw/trunk/FBConnect FBConnect
  2. Download SVN files via SourceForge tarball
  3. Browse the source code


Installation

Per the usual instructions for MediaWiki extensions,

  1. Plop the folder FBConnect into $IP/extensions/.
  2. Add the following to your LocalSettings.php file:
    require_once("$IP/extensions/FBConnect/FBConnect.php");
  3. Configuration parameters must be entered into config.php (after you rename this file from config.sample.php).
reference