Manual:$wgConditionalUserOptions
User accounts, authentication: $wgConditionalUserOptions | |
---|---|
Default user preferences. |
|
Introduced in version: | 1.42.0 (Gerrit change 978537; git #6c8b6960) |
Removed in version: | Still in use |
Allowed values: | See below |
Default value: | [] |
Other settings: Alphabetical | By function |
Conditional user options are a feature that makes it possible for default values of user preferences to be conditionally defined based on the considered user. For example, all users who registered after a certain date will have the preference enabled by default, while users who registered earlier have the feature disabled. This is useful when a given feature should be enabled for newly registered users only.
Value format
edit$wgConditionalUserOptions
is a map of user options to lists of conditional defaults descriptors.
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).
- Example configuration
$wgConditionalUserOptions['user-option'] = [
[
'registered after 2023',
[
CUDCOND_AFTER, '20240101000000'
]
],
];
Available conditions
editCUDCOND_AFTER
(1 string argument): user registered after the specified timestampCUDCOND_ANON
(no argument): user not registeredCUDCOND_NAMED
(no argument): normal non-temporary registered usersCUDCOND_USERGROUP
: users with a specific user group