Open main menu

Manual:Hooks/AbortTalkPageEmailNotification

< Manual:Hooks
AbortTalkPageEmailNotification
Available from version 1.22.0 (Gerrit change 67901)
Disable email notifications of edits to users' talk pages.
Define function:
public static function onAbortTalkPageEmailNotification( User $targetUser, Title $title ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"AbortTalkPageEmailNotification": "MyExtensionHooks::onAbortTalkPageEmailNotification"
	}
}

For MediaWiki ≤1.25:

$wgHooks['AbortTalkPageEmailNotification'][] = 'MyExtensionHooks::onAbortTalkPageEmailNotification';
Called from:File(s): includes/mail/EmailNotification.php
Function(s): canSendUserTalkEmail

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

This hook allows extensions to disable the regular talk page email notifications.

For example, Extension:Echo does this because it creates a new system of notifications (including to send an email, if the user desires, which would otherwise result in more than one email notification).

ParametersEdit

Handlers of this hook receive two parameters:

  • User $targetUser The user who's talk page is being edited, to whom the notification will be sent.
    This is equivalent to $targetUser = User::newFromName( $title->getText() );
  • Title $title The Title of the talk page.

Return valuesEdit

Handlers of this hook should return:

  • false to disable the built-in email notification; or
  • true to enable it.