Manual:Hooks/EmailConfirmed

From MediaWiki.org
Jump to navigation Jump to search
EmailConfirmed
Available from version 1.7.0
Replace default way to check whether user's email is confirmed
Define function:
public static function onEmailConfirmed( $user, &$confirmed ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"EmailConfirmed": "MyExtensionHooks::onEmailConfirmed"
	}
}

For MediaWiki ≤1.25:

$wgHooks['EmailConfirmed'][] = 'MyExtensionHooks::onEmailConfirmed';
Called from:File(s): user/User.php

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

Details[edit]

When checking that the user's email address is "confirmed" using an alternative method:

  • $user: User information
  • $confirmed: To be set by the hooked function. true for confirmed, false otherwise.

This runs before the other checks, such as anonymity and the real check; return true to allow those checks to occur, and false if checking is done.

By default, the address is considered confirmed if it is set and valid, and either the user has clicked on the link in an address confirmation email, or $wgEmailAuthentication is false.

See also[edit]