来源:http://www.mediawiki.org/wiki/Manual:Preventing_access/zh
编辑LocalSettings.php文件:
//匿名用户不能浏览和编辑页面 $wgGroupPermissions['*' ]['createaccount'] = false; $wgGroupPermissions['*' ]['read'] = false; $wgGroupPermissions['*' ]['edit'] = false;
再用一个插件,禁止匿名用户查看导航栏,来源:http://www.mediawiki.org/wiki/Extension:HideSidebar
编辑LocalSettings.php文件,加入:
require_once("$IP/extensions/HideSidebar/HideSidebar.php"); //匿名用户隐藏sidebar
其中$IP为你安装wiki系统的根目录。
extensions/HideSidebar/HideSidebar.php 内容:
if ( !defined( 'MEDIAWIKI' ) ) { echo "Not a valid entry point"; exit( 1 ); } $wgExtensionCredits['other'][] = array( 'path' => __FILE__, 'name' => 'HideSidebar', 'version' => '1.0.1', 'author' => 'Jlerner', 'url' => 'http://www.mediawiki.org/wiki/Extension:HideSidebar', 'description' => 'Allows to hide the sidebar from anonymos users', ); $wgHooks['SkinBuildSidebar'][] = 'efHideSidebar'; function efHideSidebar($skin, &$bar) { global $wgUser; // Hide sidebar for anonymous users if (!$wgUser->isLoggedIn()) { $url = Title::makeTitle(NS_SPECIAL, wfMsg('login'))->getLocalUrl(); $bar = array( 'navigation' => array( array('text' => 'Login', 'href' => $url, 'id' => 'n-login', 'active' => '') ) ); } return true; }