Jump to content

Manual:Hooks/EmailConfirmed

From mediawiki.org
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": "MediaWiki\\Extension\\MyExtension\\Hooks::onEmailConfirmed"
	}
}
Called from: File(s): user/User.php
Interface: EmailConfirmedHook.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]