FANDOM


Template:Mbox

Template:SkinCategoryConvertor

By default, Wikia only shows badges for "Founder", "Admin" and "Blocked" (and "VSTF", "Staff", etc). That's nice and all, but what about Bureaucrats, Patrollers, Rollbackers, etc? This script allows you to automatically add extra badges for these other groups (the exact groups can be customised).

You can also invent your own badges to give out to certain users, like awarding a custom "Muckraker" badge to the person who adds the most references to articles for example. This script also includes all the functionality of InactiveUsers so you don't need that if you use this (you'll end up with 2 inactive badges if you have both).

Template:Clr

Installation

To import the script, add the following code to MediaWiki:Common.js:

importArticle({type:'script', article:'w:c:dev:UserBadges/code.js'});

To customise the scripts behaviour, you'll need to place a configuration block before the previous code:

window.UserBadgesJS = {
	inactive: 30, // Inactive if no edits in this many days, 0=disabled
	gone: {}, // List of users who have formally left but it hasn't been 'inactive' days yet
	groups: { bureaucrat:1, patroller:1, rollback:1, chatmoderator:1 },
	stopBlocked: true, // Don't display any non-custom badges for blocked users
	newusers: true, // Tag non-autoconfirmed users (MW1.19 only)
	nonusers: true, // Tag global Wikia accounts that have never edited anything
	custom: {}, // Map of user names to arrays of strings
	names: {} // Badge display names
}

For information about translations or changing the badge text, see "Badge Text / Translation".

All of the options above are optional, you can just leave out the ones you don't want to change, the default value will be used instead.

inactive
This option controls the Inactive User badge. It's a number stating the maximum number of days since the user last edited something. If the user has not editing anything inside of that time then an "Inactive" badge will be attached to their name. Set to 0 to disable this feature. Default: 30.
Example
inactive: 60, // No edits in 60 days = inactive badge
inactive: 0, // Don't use the inactive badge ever, unless in the gone list
gone
This option lists users who have announced they are leaving but it has been less than inactive days so you want to force the "inactive" badge on them. The gone list is processed independently of the inactive option above, this option will still add "inactive" badges even if inactive is set to 0 (disabled). This value is an object map, not an array. Default: null.
Example
// Mark these users as inactive, even if they edited recently
gone: {'Some User Name':true, 'Some Other User':true},
groups
A list of formal MediaWiki groups (The sort that show up on Special:ListUsers) that you want to add badges for. If any user is in any of these groups then a badge will be created automatically. This is case-sensitive and must match the MediaWiki group exactly. You can set this to null or an empty literal to disable it. Default: {bureaucrat:true, patroller:true, rollback:true, chatmoderator:true}
Example
groups: {bureaucrat:true}, // Give all Bureaucrats a badge saying "Bureaucrat"
stopBlocked
This is a flag that prevents the script from giving any non-custom badges to users who are banned. Disabling this means that a banned chatmoderator will still have their chatmoderator badge for example. It also means that the banned user can be given an "inactive" badge as well. You probably don't want to turn this off. Default: true.
newusers
This flag controls whether newly registered users should be badged with a "New Editor" badge. Internally, the script checks for the autoconfirmed group; this MediaWiki group is only present on users who have held an account for 4 days and made 10 edits. [You cannot customise the length of time or number of edits, the server decides that, not this script] Note that this is global across all of Wikia, it doesn't have to be 10 edits on your wiki, just any wiki. Default: true.
nonusers
This flag controls whether global Wikia accounts that have never edited your particular Wiki will be badged with a "Never Edited" badge. Default: true.
custom
This option allows you to make up your own badges to give out instead of just relying on the automatic ones. This is a map of user names to arrays of badges.
Example
custom: { 'UserName 1': ['My Badge 1', 'My Badge 2'], 'UserName 2': ['Other Badge'] },
names
This option converts the internal software groups into human readable text, if you are an English speaker then the defaults will generally suffice unless you want to customise it. Non-English speakers will need to set this option in order to translate certain badge names. The script makes a best effort to download translations from your Wiki's server but some groups don't exist on the server so have to be translated manually. See "Badge Text / Translation".

The names option in the configuration data controls the text that will be displayed on each badge. The script includes a partial set of English names and automatically attempts to download the rest from the server's localisation data. The partial English set is not available on the server so you will need to override these in order to translate them into your language. The format of names is an object map. The messages shown below must be overridden to translate the badges, these ones will never translate themselves automatically like the others do.

window.UserBadgesJS = {
	// ...
	names: {
		patroller: 'Patroller', // patroller group member badge text
		rollback: 'Rollback', // rollback group member badge text
		newuser: 'New Editor', // Text shown on the newuser badge
		inactive: 'Inactive', // Text shown on the inactive user badge
		nonuser: 'Never Edited' // Text shown on the nonuser badge
	}
	// ...
};

Simply change the text in quotes to whatever you like in order to customise or translate the message. For MediaWiki groups, you can determine whether a group needs a manual translation by going to: Special:AllMessages on your Wiki. If the group doesn't have a message in the list then you will need to fill in the names section appropriately. [I believe it's also possible to create the missing messages on the server instead but you should only do that if you know what you're doing]

You can also speed-up your pages by manually translating the groups in the groups list so that the script won't have to download those from the server separately. This is entirely optional though, not doing this has the benefit that the script will use properly gendered nouns.

Each badge has a CSS class attached to it that allows you to change the appearance via MediaWiki:Wikia.css. The classes are just the group name with '-user' on the end. For example:

/* Make the Bureaucrat badge red */
.bureaucrat-user { background-color: red !important }
/* Make the Chat Moderator badge green */
.chatmoderator-user { background-color: green !important }
/* Make inactive user badge yellow */
.inactive-user { background-color: yellow !important }

All My Badges are Sticking Together!

On MediaWiki 1.19, Wikia decided to remove the margins between each badge for whatever reason. You can fix that by adding this CSS to your MediaWiki:Wikia.css.

#WikiaUserPagesHeader .UserProfileMasthead .masthead-info .tag + .tag {
margin-left: 5px;
}

Limitations

Badges are produced in the following order:

  1. MediaWiki groups
  2. Custom badges
  3. Inactive badge

This cannot be changed.

The Wikia generated badges ("Founder", "Admin", "Blocked") will not be deleted, moved or changed. All badges produced by the script will be put after the Wikia ones. You probably don't want to remove the "VSTF"/"Staff" badges and it may be a Terms of Use violation to do so anyway.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.