Manual:Hooks/BeforeWatchlist

From MediaWiki.org
Jump to navigation Jump to search
BeforeWatchlist
Available from version 1.12.0
Removed in version 1.14.0
Override watchlist display or add extra SQL clauses.
Define function:
public static function onBeforeWatchlist( $nondefaults, $user, &$hookSql ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"BeforeWatchlist": "MyExtensionHooks::onBeforeWatchlist"
	}
}

For MediaWiki ≤1.25:

$wgHooks['BeforeWatchlist'][] = 'MyExtensionHooks::onBeforeWatchlist';
Called from:File(s): specials/SpecialWatchlist.php

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

Details[edit]

  • $nondefaults: Assoc array with the following keys: days, hideOwn, hideBots, hideMinor, namespace
  • $user: User object.
  • &$hookSql: a string which will be inserted without sanitation into the SQL query used to get the watchlist, at the end of the WHERE part.