Extension:Facebook
| Language: | English • Deutsch |
|---|
|
Facebook Open Graph Release status: stable |
|||
|---|---|---|---|
![]() |
|||
| Implementation | User identity, Parser extension, Tag, Special page, Ajax | ||
| Description | Facebook Open Graph for MediaWiki | ||
| Author(s) | Garrett Bruin Sean Colombo |
||
| Last version | 4.0.2-stable (March 27, 2012) | ||
| MediaWiki | 1.16, 1.17, 1.18, 1.19, 1.20 | ||
| Database changes | yes | ||
| License | GPLv2 | ||
| Download | Download zip from GitHub
View Network on GitHub for forks and bugfixes from other developers |
||
|
|||
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. Many thanks go to the Wikia Development Team for their help in the development of this extension.
Contents |
Download [edit]
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 developers.
Installation [edit]
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.
require_once("$IP/extensions/Facebook/Facebook.php");
Database update [edit]
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
If worse comes to worse, you can find the schema here: user_fbconnect.sql.
Fixing Database prefix problems [edit]
If you use a database prefix, the maintenance update script may fail. In that case, add your database prefix to the schema files in /extensions/Facebook/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 [edit]
- 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.
- When updating from an older version, consider bumping $wgStyleVersion.
Facebook Open Graph [edit]
By enabling $wgFbOpenGraph 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.
Facebook Timeline [edit]
This extension supports pushing actions to a user's Timeline. See the documentation in config.default.php for how to configure your application within Facebook. Note that before actions show up in Timelines they must first be submitted and approved by Facebook.
Customizing the extension [edit]
Configuration [edit]
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 require_once statement above.
## ## Facebook Connect ## require_once("$IP/extensions/Facebook/Facebook.php"); $wgFbAppId = '47406044892'; $wgFbSecret = '04137a722facf86d075f737ab6e93818';
User login form [edit]
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
Don't have an account? $1. You can also <span class="mw-facebook-logo">[[Special:Connect|log in with Facebook]]</span>. <fb:login-button show-faces="true" width="450" max-rows="1" scope="auto"></fb:login-button><br/><br/>
The extension will automatically fill in scope="auto" with the correct permissions as determined by your configuration parameters.
Facebook permissions [edit]
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.
$wgHooks['FacebookPermissions'][] = 'fnMyHook'; function fnMyHook( &$scope ) { // Unset a permission foreach ( $scope as $i => $perm ) { if ( $perm == 'email' ) unset( $scope[$i] ); } // Require an additional permission $scope[] = 'publish_actions'; return true; }
Social plugins [edit]
XFBMLAvailableTags 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 configuration parameter.
$wgHooks['XFBMLAvailableTags'][] = 'fnMyHook'; function fnMyHook( &$tags ) { // Disable a tag foreach ( $tags as $i => $tag ) { if ( $tag == 'fb:like' ) unset( $tags[$i] ); } // Add a new tag $tags[] = 'fb:roundhouse-kick'; return true; }
Social plugins color scheme [edit]
XFBMLSkinColorScheme 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" parameter on dark-themed wikis. You can override this on a per-plugin basis by explicitly specifying colorscheme="light" 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.
$wgHooks['XFBMLSkinColorScheme'][] = 'fnMyHook'; function fnMyHook( &$skins ) { $skins['mistylook'] = 'dark'; return true; }
See also [edit]
- Guide: Facebook for Websites
- News: Facebook Connect Now Live
- List of bugfixes by the Wikia development team.
- Stable extensions
- User identity extensions
- Parser extensions
- Tag extensions
- Special page extensions
- Ajax extensions
- ArticleViewHeader extensions
- AutopromoteCondition extensions
- BeforePageDisplay extensions
- LoadExtensionSchemaUpdates extensions
- MakeGlobalVariablesScript extensions
- ParserFirstCallInit extensions
- PersonalUrls extensions
- ResourceLoaderGetConfigVars extensions
- SkinTemplateOutputPageBeforeExec extensions
- SpecialListusersFormatRow extensions
- SpecialPage initList extensions
- UserCan extensions
- UserComparePasswords extensions
- UserGetRights extensions
- UserLoadAfterLoadFromSession extensions
- All extensions
- Facebook extensions
