来源:http://www.mediawiki.org/wiki/Manual:Preventing_access/zh
编辑LocalSettings.php文件:
1 2 3 4 | //匿名用户不能浏览和编辑页面 $wgGroupPermissions [ '*' ][ 'createaccount' ] = false; $wgGroupPermissions [ '*' ][ 'read' ] = false; $wgGroupPermissions [ '*' ][ 'edit' ] = false; |
再用一个插件,禁止匿名用户查看导航栏,来源:http://www.mediawiki.org/wiki/Extension:HideSidebar
编辑LocalSettings.php文件,加入:
1 | require_once ( "$IP/extensions/HideSidebar/HideSidebar.php" ); //匿名用户隐藏sidebar |
其中$IP为你安装wiki系统的根目录。
extensions/HideSidebar/HideSidebar.php 内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | if ( !defined( 'MEDIAWIKI' ) ) { echo "Not a valid entry point" ; exit ( 1 ); } $wgExtensionCredits [ 'other' ][] = array ( 'path' => __FILE__ , 'name' => 'HideSidebar' , 'version' => '1.0.1' , 'author' => 'Jlerner' , '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; } |