Customize Your Wiki
Register
Advertisement

These custom username badges show in recent changes, the wiki activity sidebar, and on message walls. It can be used to show that users are staff.

Installing[]

You have to add the code to your custom CSS. (MediaWiki:Common.css)

First, add these styles to make the badges correctly appear.

/* Custom username badges */
[class^='EntityHeader_name__']::after,
[class^='mw-userlink']::after,
.edit-info-user::after,
.lastEdited > a:after {
	display: inline-block;
	margin-left: 6px;
	width: 16px;
	height: 16px;
	background-size: cover;
	vertical-align: sub;
}

/* Adjust base styles for Recent Wiki Activity rail module */
.edit-info-user::after {
	margin-left: 0;
	width: 12px;
	height: 12px;
	transform: translate(0px, -1px);
}

Next, add the below code for every user you want to have a badge. You have to replace USERNAME with your username and BADGE with the URL of an image of the badge you want. You can see some example badge images below.

/* Set badges for users */
:is([class^='EntityHeader_name__'][href='/wiki/User:USERNAME'], [class^='mw-userlink'], .edit-info-user, .lastEdited > a)[href='/wiki/User:USERNAME']::after {
	content: '';
	background-image: url(BADGE);
}

When installing on the Wiki with specified language code, please add the following codes below to make the badge worked properly.

Langcode refers to zh, de,..., etc.. More details can be referred from Community Central.

/* Set badges for users */
:is([class^='EntityHeader_name__'][href='/(langcode)/wiki/User:USERNAME'], [class^='mw-userlink'], .edit-info-user, .lastEdited > a)[href='/(langcode)/wiki/User:USERNAME']::after {
	content: '';
	background-image: url(BADGE);
}

Badges[]

Name Image URL
Administrator Badge-Admin.svg https://static.wikia.nocookie.net/central/images/1/12/Badge-Admin.svg
Content Moderator Badge-ContentModerator.svg https://static.wikia.nocookie.net/central/images/e/ef/Badge-ContentModerator.svg
Discussions Moderator Badge-DiscussionsModerator.svg https://static.wikia.nocookie.net/central/images/5/50/Badge-DiscussionsModerator.svg

Wikis that have this feature[]

Advertisement