How to remove preconfigured user groups in MediaWiki

As you know MediaWiki comes preconfigured with a few default user groups. You can change the permissions of these groups, assign them to users, and create new groups. If you want to remove a default group, you can do that as well. Basically, the main thing that you have to do to achieve this is to remove/unset the group permissions of that group. Users who belong to the removed group will not have the user rights of that group anymore. Note however that they may belong to other groups that have some or all of the permissions of the removed group. Then they'll be able to do the things specified by these rights.

You can do unset the permissions of a group by adding the following code on a new line at the end of the LocalSettings.php file of your MediaWiki:

unset( $wgGroupPermissions['group-name'] );

You have to replace group-name with the actual name of the group. So, for example, if you want to remove the administrator/sysop group, you should put the following:

unset( $wgGroupPermissions['sysop'] );

Of course, it's a good idea before that to consider what users are in the group and whether you should put them in another group that you've created with the desired set of permissions.

Note that the above code is enough to disable the group, but it's recommended that when you remove a group you also unset a few other options. So, for example, if you want to remove the sysop user group, the best practice is to put the following at the end of the LocalSettings.php file:

unset( $wgGroupPermissions['sysop'] );
unset( $wgRevokePermissions['sysop'] );
unset( $wgRemoveGroups['sysop'] );
unset( $wgAddGroups['sysop'] );
unset( $wgGroupsAddToSelf['sysop'] );
unset( $wgGroupsRemoveFromSelf['sysop'] );

In case you want to remove another default group just put its label in the square brackets. Each default group has an exact label that you have to use in the code. For more information on what the labels for the default groups are, as well as on how to change permissions, check out the section on how to create groups and change permissions in the tutorial on how to manage users, user groups and permissions in MediaWiki.

The LocalSettings.php file that you have to edit to remove groups is in the root MediaWiki folder on your MediaWiki hosting account. If, for example, the application is installed in the public_html directory, then the path to the file on the account will be public_html/LocalSettings.php. HostKnox customers can edit files directly on the account from the Files section of the Pixie control panel. It can also be done by downloading the file on the local computer, editing it with a text editor (e.g. Notepad) and uploading it back overwriting the file. Files can also be edited on the account via SSH.

Was this answer helpful?

 Print this Article

Also Read