Manual:Hooks/WatchArticle

From MediaWiki.org
Jump to navigation Jump to search
WatchArticle
Available from version 1.4.0
Occurs whenever the software receives a request to watch an article
Define function:
public static function onWatchArticle( $user, $article, &$status ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"WatchArticle": "MyExtensionHooks::onWatchArticle"
	}
}

For MediaWiki ≤1.25:

$wgHooks['WatchArticle'][] = 'MyExtensionHooks::onWatchArticle';
Called from:File(s): Article.php

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

Details[edit]

  • $user: user that will watch
  • $page: WikiPage object to be watched
  • &$status: Status object to be returned if the hook returns false

See also[edit]