Manual:Hooks/BeforeResetNotificationTimestamp

From MediaWiki.org
Jump to navigation Jump to search
BeforeResetNotificationTimestamp
Available from version 1.32.0 (Gerrit change 473958)
Allows prevention of clearing of notification timestamp when a user views a page in their watchlist.
Define function:
public static function onBeforeResetNotificationTimestamp( User $user, title $title, string $force, int $oldId ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"BeforeResetNotificationTimestamp": "MyExtensionHooks::onBeforeResetNotificationTimestamp"
	}
}

For MediaWiki ≤1.25:

$wgHooks['BeforeResetNotificationTimestamp'][] = 'MyExtensionHooks::onBeforeResetNotificationTimestamp';
Called from:File(s): watcheditem/WatchedItemStore.php
Function(s): resetNotificationTimestamp

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

Details[edit]

  • &$user: User object
  • &$title: Title object
  • &$force: Whether or not the write query is forced to be executed even if the page is not watched or the notification timestamp is already NULL.
  • $oldId: The revision ID being viewed. If not given or 0, latest revision is assumed.