Open main menu
This page is a translated version of the page Manual:$wgDefaultUserOptions and the translation is 30% complete.

Other languages:
English • ‎español • ‎français • ‎italiano • ‎magyar • ‎polski • ‎português • ‎português do Brasil • ‎čeština • ‎हिन्दी • ‎中文 • ‎日本語 • ‎한국어
用户: $wgDefaultUserOptions
默认用户参数设置。
引进版本:1.4.0
移除版本:仍在使用
允许的值:参见下方
默认值:参见下方

要添加新的用户参数设置,请参阅: 手册:钩子/GetPreferences

LocalSettings.php的以下更改将覆盖匿名访问者和未自定义其参数设置的用户的参数设置。 Existing user accounts who had the (previous) default option and didn't set it explicitly (which means that it's not stored in the database) will then use the new default.

Note: in the old preferences system, the change affects only anonymous visitors (if relevant) and new accounts.

可用参数设置

以下用户参数设置可用于自定义:

名称 默认值 说明
用户资料
fancysig 0 用户是否使用自定义(原始)签名(0或1)。 If user has not set a custom signature, their signature is controlled by the contents of the wiki page mediawiki:Signature or mediawiki:Signature-anon. If user has specified a custom sig, the actual text of the signature is in the nickname option.
nickname (空字符串) Actual text of the custom signature
rememberpassword 0 Whether to remember the user's password between sessions.
enotifwatchlistpages 1 当用户的监视列表中的页面更改时发送电子邮件通知用户 仅在设置$wgEnotifWatchlist 时使用。
enotifusertalkpages 1 Email notification to editor if there are changes to the editor's talk page. 仅在设置$wgEnotifUserTalk 时使用。
enotifminoredits 0 Email notification to editor if there is a minor change to a watched page or user talk page, and the relevant option for sending emails on changes to watched page or user talk page is on. 仅在设置$wgEnotifWatchlist $wgEnotifUserTalk 时使用。
enotifrevealaddr 0 Only used if $wgEnotifRevealEditorAddress and either $wgEnotifWatchlist or $wgEnotifUserTalk are set.
gender 未知 Used for gender-correct addressing by the software. 这些信息将公开。 Options are: male, female, or unknown.
realname Default “real name”. 真实姓名是可选的。 If you choose to provide it, this will be used for giving you attribution for your work. Use $wgHiddenPrefs to disable the real name field in version 1.16+. Use $wgAllowRealName for 1.16-.
language User specific interface language, especially useful in conjunction with $wgHiddenPrefs .
This is not to set the wiki's default language. Use $wgLanguageCode instead.
Quickbar
disablemail 0 Whether other users can send eMail to this user, if $wgEnableUserEmail is enabled.
quickbar Quickbar location (only applies if using Cologne Blue or Classic skins). Options are: 0 - None, 1 - Fixed left, 2 - Fixed right, 3 - Floating left, 4 - Floating right, 5 (since 1.19) - Left/right depending on your language.
皮肤
skin false 使用哪种皮肤。 May be false to indicate that the site default (as defined in $wgDefaultSkin ) should be used. Previously, numbers were used to designate skins. The only numerical values that are currently operative (as of MediaWiki 1.29) are 0, which means the default skin, and 2, which means Cologne Blue.
Math
math 1 How to render in-line maths (contents of <math></math> tags). Only applies if $wgUseTeX is set. Options are: 0 - Always render PNG, 1 - Leave it as TeX (for text browsers)
Files
imagesize 2 Size to limit images on description pages to. Values correspond to the entries in $wgImageLimits . By default, 2 is 800*600.
thumbsize 5 Thumbnail size - Values correspond to the entries in $wgThumbLimits . By default, 5 is 300px.
日期和时间
date 默认值 日期格式。 选项:
  • 'default': No preference
  • 'mdy': 16:12, January 15, 2011
  • 'dmy': 16:12, 15 January 2011
  • 'ymd': 16:12, 2011 January 15
  • 'ISO 8601': 2011-01-15T16:12:34
  • 'persian': 15 Farvardin 1390 SH (Iranian Calender, Persia)
timecorrection A fixed timezone offset or ZoneInfo zone, e.g.:
  • -9 (UTC minus 9 hours; will not adjust for Daylight Saving)
  • 'ZoneInfo|-240|America/New_York' (tz database zone for NY; will adjust for Daylight Saving)
Editing
rows 25 Edit box size (rows) (在1.29版本中已弃用)
cols 80 Edit box size (columns) (在1.29版本中已弃用)
editsection Enable section editing via [edit] links. Behaviour changed in 1.23: add .mw-editsection { display:none!important; } to site-wide or user CSS, see phabricator:T54811.
editsectiononrightclick 0 启用右击段落标题编辑段落 (JavaScript)
editondblclick 0 双击编辑页面 (JavaScript)
showtoolbar 1 Show edit toolbar (requires javascript)
previewonfirst 0 首次编辑时显示预览
previewontop 1 在编辑框上方显示预览
minordefault 0 默认标记所有编辑为小编辑
externaleditor 默认使用外部编辑器
externaldiff 默认使用外部差异
uselivepreview 0 Only used if $wgLivePreview is true.
forceeditsummary 0 Prompt user when entering a blank edit summary
editfont 默认值 Edit area font style. Options are: default (browser default), monospace, sans-serif, serif.
useeditwarning 1 当我离开编辑页面时,如果有尚未保存的更改,请提醒我
最近更改
rcenhancedfilters-disable false Default value is false, but if is not installed VisualEditor , is on the special page Recent changes displayed only unusable banner, instead search form. Authorized user may do change over your preferences. But anonymous user not. For it is recommend set true.
rcdays 7 Days to show in recent changes (cannot exceed $wgRCMaxAge )
rclimit 50 Maximum number of entries to display in recent changes (truncates rcdays)
hideminor 0 在最近更改中隐藏小编辑
shownumberswatching 1 Show the number of users, who are watching this page (on recent changes, watch list and article pages). Only used if $wgRCShowWatchingUsers is set.
usenewrc 1 Enhanced recent changes - javascript collapsible tree
hidepatrolled 0 在最近更改中隐藏已巡查过的编辑
newpageshidepatrolled 0 在新页面列表中隐藏已巡查页面
hidecategorization 1 隐藏页面的分类
监视列表
wlenhancedfilters-disable false Default value is false, but if is not installed VisualEditor , is recommend set default as true.
watchlistdays 3.0 监视列表中显示的天数(不能超过$wgRCMaxAge
extendwatchlist 1 展开监视列表以显示所有适用的更改
wllimit 250 Number of edits to show in expanded watchlist (if 'extendwatchlist' == 1)
watchlisthideown 0 隐藏监视列表中的我的编辑
watchlisthidebots 0 隐藏监视列表中的机器人编辑
watchlisthideminor 0 隐藏监视列表中的小编辑
watchcreations 1 Add pages the user creates and files they upload to their watchlist
watchrollback 0 Add pages where the user has performed a rollback to their watchlist
watchlisthideanons 0 Hide anonymous users' changes from the watchlist
watchlisthideliu 0 Hide logged-in users' changes from the watchlist
watchlisttoken Token of watchlist
watchlisthidepatrolled 0 隐藏监视列表中的已巡查编辑
watchlistreloadautomatically 0 当一条过滤器规则被更改时,自动重新加载监视列表(需要JavaScript)
watchlistunwatchlinks 0 为有更改的监视页面添加直接(取消)监视标记(×/+,需要JavaScript才能打开功能)
watchlisthidecategorization 1 Hides changes to category membership
watchdefault 1

Add pages the user edits to their watchlist, checking the "Watch this page" by default on all edited pages.

This option can be disabled by editors in Preferences → Watchlist tab → Watched pages section and unchecking "Add pages and files I edit to my watchlist"

watchmoves 0 Add pages the user moves to their watchlist
watchdeletion 0 Add pages the user deletes to their watchlist
watchuploads 1 Add new files the user uploads to their watchlist
Search
searchlimit Hits per page
vector-simplesearch Whether or not the Vector skin should use the simple search box (Options are 1 for true and 0 for false). (在1.23版本中已移除)
ajaxsearch Enables AJAX Search (Options are 1 for true and 0 for false)
searcheverything Search in all namespaces. (在1.24版本中已移除) [1]
searchnamespaces Add 'searchnamespaces' to $wgHiddenPrefs to prevent users from customizing “namespaces to be searched by default” in their preferences (they will still be able to set which namespaces should be searched on Special:Search). Use $wgNamespacesToBeSearchedDefault to set which namespaces are enabled for searching by default.
Misc
stubthreshold 0 Threshold for stub display
underline 2 Whether to underline links. Options are: 0 - never, 1 - always, 2 - browser default
justify Justify paragraphs
numberheadings 0 Option "Auto-numbering Headings", 1 turns on the numbering of all headings within articles
showtoc Boolean. 1 is show the TOC, 0 is hide it.
nocache 禁用页面缓存
showhiddencats 0 显示隐藏的分类
showjumplinks Enable "jump to" accessibility links
diffonly 0 不要在差异下显示页面内容
norollbackdiff 0 执行回退后不显示差异
ccmeonemails 0 把我给其他用户发送的电子邮件的副本发送给我
prefershttps 1 在登录后总是使用安全连接
Extension:WikiEditor (packaged with MediaWiki 1.18+)
usenavigabletoc Enable navigable table of contents
wikieditor-publish 启用逐步发布
wikieditor-preview 启用并排预览
usebetatoolbar 启用增强编辑工具栏
usebetatoolbar-cgd 启用对话框以插入链接,表格等
Extension:LiquidThreads
lqt-watch-threads 监视我发起或回复的话题 (true by default)
lqtnotifytalk 当监视话题有新回复时发送电子邮件通知我 (false by default)
Extension:Flow
echo-subscriptions-web-flow-discussion ⧼echo-subscriptions-web-flow-discussion⧽ (true by default)
echo-subscriptions-email-flow-discussion ⧼echo-subscriptions-email-flow-discussion⧽ (false by default)
Extension:VisualEditor
visualeditor-betatempdisable 0 Temporarily disable the visual editor while it is in beta

Notes:

  • New settings are added to MediaWiki periodically. Some of these settings have been added since $wgDefaultUserOptions was introduced in v1.4.0. Currently there is no documentation about when settings were added.
  • It is possible for extensions and language files to add extra toggles to the 'misc' tab. Languages that use this feature should have the setting described here. Extensions should add the information to their extension page.
  • This list is not up to date with the latest MediaWiki Version. List options with --list (see Manual:userOptions.php ).

小工具选项

gadget-$gname e.g. gadget-HotCat for MediaWiki:Gadget-HotCat.js

默认值

每种语言都在其语言文件中为用户参数设置各自的默认值。 For example languages that read right-to-left will probably set the Quickbar to appear on the right, instead of on the left. The values added to $wgDefaultUserOptions are overrides, i.e. if the value exists here then it will take precedence, but settings may be omitted from the array in which case the language's default value will be used.

In versions of MediaWiki prior to 1.8.0 the default value of this setting was simply an empty array, with the current language providing the default values.

From version 1.8.0 onwards, only the language-specific settings were overridden in the language file, so most settings are now explicitly set in DefaultSettings.php.

From version 1.19 (r91432), the overrides by the language files were removed because they didn't work, and the features that used them, like quickbar, have been done differently and better.

示例

To disable section editing links by default (for new and anonymous users), set the following in LocalSettings.php:

$wgDefaultUserOptions['editsection'] = 0;

Note: From version 1.23 onwards, the section editing links need to be disabled via site-wide or user CSS, see phabricator:T54811 for details on the change.

MediaWiki:Common.css: .mw-editsection { display:none!important; }

默认情况下,将用户编辑的页面添加到其监视列表:

$wgDefaultUserOptions['watchdefault'] = 1;

If the preference is of type multiselect, things are a bit more complicated. The key for each default user option is the concatenation of the preference key with the option key. For example if the preference key is 'favoritecolors' and the option key is 'red', the default user option key would be 'favoritecolorsred'. In this hypothetical scenario, if you wanted to have red and yellow selected by default, you would use:

$wgDefaultUserOptions['favoritecolorsred'] = 1;
$wgDefaultUserOptions['favoritecolorsyellow'] = 1;

If the preference is of type checkmatrix, things are even more complicated. The key for each default user option is the concatenation of the preference key with the column key and row key, separated with hyphens. For example if the preference key is 'favoritecars' and the column key is 'red' and the row key is 'corvette', the default user option key would be 'favoritecars-red-corvette'. In this hypothetical scenario, if you wanted to have red Corvette and black Jetta selected by default, you would use:

$wgDefaultUserOptions['favoritecars-red-corvette'] = 1;
$wgDefaultUserOptions['favoritecars-black-jetta'] = 1;

When writing a MediaWiki extension, instead of using the global variable $wgDefaultUserOptions, you can add a section to extensions.json:

	"DefaultUserOptions": {
		"math": "png"
    },

参考资料

参见