Manual:Hooks/UserCanSendEmail
From Linux Web Expert
File:OOjs UI icon alert-destructive.svg | <translate>
This deprecated feature should no longer be used, but is still available for reasons of backwards compatibility. This feature was deprecated in version <tvar name=ver>1.41.0</tvar>.</translate> <translate> Please see <tvar name=page>EmailUserAuthorizeSend</tvar> for an alternative way to use this feature.</translate> |
UserCanSendEmail | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> Allows overriding the permission check in User::canSendEmail() | |
<translate> Define function:</translate> | public static function onUserCanSendEmail( $user, &$canSend ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"UserCanSendEmail": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserCanSendEmail"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> user/User.php |
<translate> Interface:</translate> | UserCanSendEmailHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:UserCanSendEmail extensions</tvar>.</translate>
Details
- $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.