Jump to content

Manual:Hooks/UserCanSendEmail

From mediawiki.org
UserCanSendEmail
Available from version 1.12.0
Allows overriding the permission check in User::canSendEmail()
Define function:
public static function onUserCanSendEmail( $user, &$canSend ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"UserCanSendEmail": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserCanSendEmail"
	}
}
Called from: File(s): user/User.php
Interface: UserCanSendEmailHook.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

By default, users can send email if email sending is enabled, they have the sendemail right, and they pass an email confirmed check.

See also

[edit]