Manual:Hooks/UserPrivilegedGroups

From Linux Web Expert

UserPrivilegedGroups
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 482589)</tvar></translate>
Use this hook to extend what MediaWiki considers to be a "privileged group" beyond the values set in $wgPrivilegedGroups
<translate> Define function:</translate>
public static function onUserPrivilegedGroups( MediaWiki\User\UserIdentity $userIdentity, array &$groups ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"UserPrivilegedGroups": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserPrivilegedGroups"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> includes/user/UserGroupManager.php
<translate> Interface:</translate> UserPrivilegedGroupsHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:UserPrivilegedGroups extensions</tvar>.</translate>


Details

  • $userIdentity: User identity to get groups for
  • &$groups Current privileged groups, to be altered by the hook

See also