Manual:Hooks/AutopromoteCondition

From MediaWiki.org
Jump to navigation Jump to search

Other languages:
English • ‎中文 • ‎日本語
AutopromoteCondition
Available from version 1.12.0
check autopromote condition for user.
Define function:
public static function onAutopromoteCondition( $type, $args, $user, &$result ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"AutopromoteCondition": "MyExtensionHooks::onAutopromoteCondition"
	}
}

For MediaWiki ≤1.25:

$wgHooks['AutopromoteCondition'][] = 'MyExtensionHooks::onAutopromoteCondition';
Called from:File(s): Autopromote.php

For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:AutopromoteCondition extensions.

Details[edit]

This hook only runs if the condition type does not match any of those already defined as possible conditions. If you are writing an extension that declares a constant for a new condition type, note that values 0 through 9 have already been taken by APCOND_EDITCOUNT, APCOND_AGE, etc.

  • $type: condition type
  • $args: arguments
  • $user: user
  • &$result: result of checking autopromote condition. Defaults to null; if left as null, will throw an exception ("unrecognized condition [$type] for autopromotion")