Jump to content

Manual:Hooks/AbortTalkPageEmailNotification

From mediawiki.org
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": "MediaWiki\\Extension\\MyExtension\\Hooks::onAbortTalkPageEmailNotification"
	}
}
Called from: File(s): includes/mail/EmailNotification.php
Function(s): canSendUserTalkEmail
Interface: AbortTalkPageEmailNotificationHook.php

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

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).

Parameters

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 values

Handlers of this hook should return:

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