This page is a translated version of the page Manual:Hooks/getUserPermissionsErrors and the translation is 7% complete.
Доступен с version 1.12.0
Add a permissions error when permissions errors are checked for.
Определяет функцию:
public static function ongetUserPermissionsErrors( $title, $user, $action, &$result ) { ... }
Прикрепить хук: В extension.json:
	"Hooks": {
		"getUserPermissionsErrors": "MediaWiki\\Extension\\MyExtension\\Hooks::ongetUserPermissionsErrors"
Вызывается из: Файла(Файлов): Permissions/PermissionManager.php
Interface: getUserPermissionsErrorsHook.php

Для получения дополнительной информации о присоединении перехватчиков, см Руководство:Прерывания (хуки) .
Примеры расширений с использованием этого хука см. в Category:getUserPermissionsErrors extensions/ru.


  • $title - Title object being checked against
  • $user - Current user object
  • $action - Action being checked
  • &$result - User permissions error to add. $result can be set as a single error message key (string), or an array of error message keys when multiple messages are needed (although it seems to take an array as one message key with parameters?).

Both hooks are typically run when checking for proper permissions in Title.php . When it is desirable to skip potentially expensive cascading permission checks, only getUserPermissionsErrors is run. This behavior is suitable for nonessential UI controls in common cases, but not for functional access control. This behavior may provide false positives, but should never provide a false negative.

См. также