Manual:$wgAutopromote

Access: $wgAutopromote
Conditions of automatic promotion of user to specific groups
Introduced in version:1.12.0 (r28797)
Removed in version:Still in use
Allowed values:(array)
Default value:(see below)

Details

edit

This array contains criteria of automatic promotion. The syntax is:

$wgAutopromote = [
    'groupname' => cond,
    'group2' => cond,
];

cond here may be:

Possible conditions

edit

Possible conditions (defined in Defines.php ; extensions may add more through the AutopromoteCondition hook):

Condition Description Argument(s)
APCOND_EDITCOUNT Minimum number of edits necessary.
If null or missing $wgAutoConfirmCount will be used
Integer
APCOND_AGE Minimum number of seconds since registration. If null or missing $wgAutoConfirmAge will be used Integer
APCOND_EMAILCONFIRMED Email address has been confirmed (Not applicable)
APCOND_INGROUPS List of groups the user must be in E.g., 'sysop', 'bureaucrat', 'bot'
APCOND_ISIP User has a specific IP address E.g., '1.2.3.4' or '2001:0db8:85a3::7344'
APCOND_IPINRANGE User is in a specific IP range See Manual:IP ranges
APCOND_AGE_FROM_EDIT Minimum number of seconds since first edit Integer
APCOND_BLOCKED Account is blocked (added in v1.16: r52083) (Not applicable)
APCOND_ISBOT Account is a bot (Not applicable)

Conditions with and without arguments

edit

Each condition can be written in two forms:

APCOND_EMAILCONFIRMED   # condition with no arguments
array( APCOND_EDITCOUNT, 100 )   # condition with arguments

Set of conditions

edit

Sets of conditions have the following syntax:

[ 'operand', cond1, cond2, ... ];

There are 4 operands available:

  • & (AND) — promote if user matches all conditions
  • | (OR) — promote if user matches any condition
  • ^ (XOR) — promote if user matches only one of two conditions
  • ! (NOT) — promote if user matches no conditions.

The sets of conditions are evaluated recursively, so you can use nested sets of conditions linked by operands.

Caveats

edit

Autopromotion does not actually add users to a group; MediaWiki will check whether a user meets the conditions for autopromotion whenever it checks the user's rights or effective groups. This means that a user will only appear to be in a group on Special:ListUsers if they were added to it through Special:UserRights.

Since MediaWiki 1.18 you can use AutopromoteOnce instead, which adds users normally to a group, if they match the given criteria and have not been demoted before. Alternatively, $wgRevokePermissions (MW 1.16+) might be useful for you.

Temporary users cannot be autopromoted, since they cannot be assigned to user groups.


Default values

edit
MediaWiki version:
1.38
$wgAutopromote = [
	'autoconfirmed' => [ '&',
		[ APCOND_EDITCOUNT, null],
		[ APCOND_AGE, null ],
	],
];
MediaWiki versions:
1.13 – 1.37
$wgAutopromote = [
	'autoconfirmed' => [ '&',
		[ APCOND_EDITCOUNT, &$wgAutoConfirmCount ],
		[ APCOND_AGE, &$wgAutoConfirmAge ],
	],
];
MediaWiki version:
1.12
$wgAutopromote = array(
	'autoconfirmed' => array( '&',
		array( APCOND_EDITCOUNT, &$wgAutoConfirmCount ),
		array( APCOND_AGE, &$wgAutoConfirmAge ),
	),
	'emailconfirmed' => APCOND_EMAILCONFIRMED,
);

Example

edit

If you wanted to autopromote each user to captain upon their having both confirmed their email address and either made at least 100 edits or registered their account at least 60 days ago, you would use:

$wgAutopromote = [
	'captain' => [
		'&',
		APCOND_EMAILCONFIRMED,
		[
			'|',
			[ APCOND_EDITCOUNT, 100 ],
			[ APCOND_AGE, 60*86400 ],
		],
	],
];

Note that this would get rid of all other autopromote groups; to instead add the captain autopromote group while keeping those autopromote groups that already exist, one would use:

$wgAutopromote['captain'] = [
	'&',
	APCOND_EMAILCONFIRMED,
	[
		'|',
		[ APCOND_EDITCOUNT, 100 ],
		[ APCOND_AGE, 60*86400 ],
	],
];

See also

edit