Manual:Hooks/ArticleProtect

From MediaWiki.org
Jump to: navigation, search
ArticleProtect
Available from version 1.4.0
Occurs whenever the software receives a request to protect an article

Define function:
public static function onArticleProtect( &$article, &$user, $protect, $reason, $moveonly ) { ... }

Attach hook:
$wgHooks['ArticleProtect'][] = 'MyExtensionHooks::onArticleProtect';
Called from: Article.php

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


Details [edit]

  • $article: (object) the article being protected
  • $user: (object) the user doing the protection
  • $protect*: boolean flag indicating whether the request is protect or unprotect
  • $reason: (string) Reason for protect
  • $moveonly: (boolean) flag indicating whether this is for move only or not

* prior to version 1.10, this field stored an array of restrictions that were stored in the page_restrictions field of the page table.

See also [edit]