Manual:Hooks/UserCanSendEmail

From MediaWiki.org
Jump to: navigation, search
UserCanSendEmail
Available from version 1.12.0
To override User::canSendEmail() permission check
Define function:
public static function onUserCanSendEmail( $user, &$canSend ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"UserCanSendEmail": "MyExtensionHooks::onUserCanSendEmail"
	}
}

For MediaWiki ≤1.25:

$wgHooks['UserCanSendEmail'][] = 'MyExtensionHooks::onUserCanSendEmail';
Called from: File(s): User.php

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

Details[edit]

  • $user: User (object) whose permission is being checked
  • &$canSend: bool set on input, can override on output

See also[edit]