Manual:Hooks/UserCanSendEmail

From Linux Web Expert

Revision as of 21:35, 6 December 2023 by imported>SamanthaNguyen (deprecated in 1.41.0)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

See also