Manual:Hooks/AbortTalkPageEmailNotification/zh

From Linux Web Expert

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
AbortTalkPageEmailNotification
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 67901)</tvar></translate>
禁用对用户讨论页进行编辑的电子邮件通知。
<translate> Define function:</translate>
public static function onAbortTalkPageEmailNotification( User $targetUser, Title $title ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"AbortTalkPageEmailNotification": "MediaWiki\\Extension\\MyExtension\\Hooks::onAbortTalkPageEmailNotification"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> includes/mail/EmailNotification.php
<translate> Function(s):</translate> canSendUserTalkEmail
<translate> Interface:</translate> AbortTalkPageEmailNotificationHook.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:AbortTalkPageEmailNotification extensions/zh</tvar>.</translate>

此挂钩允许扩展禁用常规讨论页面电子邮件通知。

例如,Extension:Echo这样做是因为它创建了一个新的通知系统(包括发送电子邮件,如果用户愿意,否则会导致多个电子邮件通知)

参数

该钩子的处理程序接收两个参数:

  • 用户 $targetUser 正在编辑讨论页的用户,将向其发送通知。
    这相当于$targetUser = User::newFromName( $title->getText() );
  • 标题 $title 讨论页的标题。

返回值

该钩子的处理程序应返回:

  • false 禁用内置电子邮件通知; 或者
  • true即可启用它。