扩展:Facebook
此扩展目前不再活跃维护! 尽管它可能仍然工作,但任何错误报告或功能请求将很可能被忽略。 如果您对承担开发与维护该扩展的任务工作感兴趣,您可以请求自己的存储库。 作为礼貌,您或许可以联络作者。 或者您应移除该模板,并在页面的{{extension}}信息框中将您自己列为扩展的维护人员。 |
Facebook Open Graph 发布状态: 未维护 |
|
---|---|
![]() |
|
实现 | 用户权限 , 用戶識別 , 解析器扩展 , 标签 , 特殊页面 , Ajax |
描述 | Provides Facebook Open Graph for MediaWiki |
作者 | Garrett Bruin Sean Colombo |
最新版本 | 4.0.6 (2012-09-25) |
MediaWiki | 1.16 - 1.20 |
数据庫更新 | 是 |
许可协议 | GNU通用公眾授權條款2.0 or later |
下载 |
View Network on GitHub for forks and bugfixes from other developers CHANGELOG.txt |
|
|
翻译Facebook扩展如果在translatewiki.net可用 | |
The Facebook extension allows MediaWiki users to log into the wiki with their Facebook account by integrating your wiki into Facebook's. 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. Thanks to the Wikia Development Team for their help in the development of this extension.
安装
- Download文件,并将其放置在您
extensions/
文件夹中的Facebook
目录内。
- 将下列代码放置在您的LocalSettings.php的底部:
require_once "$IP/extensions/Facebook/Facebook.php";
- 运行更新脚本,它将自动创建此扩展必须依赖的数据库表。
- 完成 – 在您的wiki上导航至Special:Version,以验证扩展已成功安装。
配置
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.
The below wgFbAppId and wgFbSecret code is an examples only, the code you need to enter are explained here after creating a new Facebook application.
##
## Facebook Connect
##
require_once("$IP/extensions/Facebook/Facebook.php");
$wgFbAppId = '47406044892';
$wgFbSecret = '04137a722facf86d075f737ab6e93818';
Database update
Your database will need to be updated to work with Facebook, which only work with PHP 5.
Some web servers still default to PHP 4. This can be checked by 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, enter this command:
$ cd path/to/site/w/ $ php maintenance/update.php
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.
If worst comes to worst, you can find the schema here: user_fbconnect.sql.
- 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 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.
Customization
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
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
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.
$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;
}
If you previously requested offline_access
, this permission was removed from Facebook on May 1, 2012. See the announcement here.
Social plugins
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
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;
}
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.
- When updating from an older version, consider bumping $wgStyleVersion .
Facebook Open Graph
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
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.
See also
- Guide: Facebook for Websites
- News: Facebook Connect Now Live
- List of bugfixes by the Wikia development team.