手册:$wgConditionalUserOptions
用户账户、身份验证: $wgConditionalUserOptions | |
---|---|
默认用户参数设置。 |
|
引进版本: | 1.42.0 (Gerrit change 978537; git #6c8b6960) |
移除版本: | 仍在使用 |
允许的值: | 参见下方 |
默认值: | [] |
其他设置: 按首字母排序 | 按功能排序 |
条件用户设置是一项允许基于用户、有条件地定义用户选项 默认值的功能。 例如,为所有在某一日期之后注册的用户默认启用某一参数设置,同时为在该日期之前注册的用户默认禁用该特性。 当只应为新注册用户启用给定功能时,这非常有用。
值格式
$wgConditionalUserOptions
是参数设置到条件默认描述符列表的映射。
Each descriptor is an array of conditional cases taking the form of [ VALUE, CONDITION1, CONDITION2, ... ]
, where VALUE
is the default value for users meeting the conditions and each condition is either:
- a
CUDCOND_*
constant (representing a condition that takes no arguments) - an array taking the form of
[ CUDCOND_*, arg1, arg2, ... ]
, where the first index defines the condition and the rest of the fields are the condition's arguments
Conditional cases are processed in the definition order; the first case with all of its conditions satisfied is used.
When multiple conditions are specified, all of them must be met for the case to be used.
When no case matches its conditions (or when none is defined), then $wgDefaultUserOptions
is used instead.
A VALUE
of null
means no conditional default (i.e. the default option from $wgDefaultUserOptions
should be used for users matching that set of conditions).
- 示例配置
$wgConditionalUserOptions['user-option'] = [
[
'registered after 2023',
[
CUDCOND_AFTER, '20240101000000'
]
],
];
可用条件
CUDCOND_AFTER
(1个字符串参数):在特定时间点之后注册的用户CUDCOND_ANON
(no argument): user not registeredCUDCOND_NAMED
(no argument): normal non-temporary registered usersCUDCOND_USERGROUP
: users with a specific user group