Available from version 1.22.0 (Gerrit change 62317)
Disable or modify the new messages alert before it is shown
Define function:
public static function onGetNewMessagesAlert( string &$newMessagesAlert, array $newtalks, User $user, OutputPage $out ) { ... }
Attach hook: In extension.json:
	"Hooks": {
		"GetNewMessagesAlert": "MediaWiki\\Extension\\MyExtension\\Hooks::onGetNewMessagesAlert"
Called from: File(s): Skin.php
Interface: GetNewMessagesAlertHook.php

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


  • &$newMessagesAlert - An empty string by default. If the user has new talk page messages, this should be populated with an alert message to that effect
  • $newtalks - An empty array if the user has no new messages or an array containing links and revisions if there are new messages (See User::getNewMessageLinks)
  • $user - The User object of the user who is loading the page
  • $out - OutputPage object (to check what type of page the user is on)

See also[edit]