From mediawiki.org
This page is a translated version of the page Extension:WikiLove and the translation is 30% complete.
Outdated translations are marked like this.
发行状态: 稳定版
实现 用户界面
描述 使在用户讨论页添加积极反馈变得更容易
作者 Ryan Kaldari, Jan Paul Posma, Brandon Harris (设计)
最新版本 1.3.1
兼容性政策 快照跟随MediaWiki发布。 master分支不向后兼容。
MediaWiki 1.27+
许可协议 MIT授權條款

  • $wgWikiLoveGlobal
  • $wgWikiLoveTabIcon
  • $wgWikiLoveLogging
季度下載量 17 (Ranked 130th)
問題 开启的任务 · 报告错误

WikiLove 是一个扩展,旨在促进 WikiLove 在维基百科和可能的其他维基中的传播。 具体来讲,它使向用户讨论页添加奖励、礼物和邀请变得像单击几个按钮一样简单。


  • 下载文件,并将其放置在您extensions/文件夹中的WikiLove目录内。
    开发者和代码贡献人员应从Git安装扩展,输入:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiLove
  • 将下列代码放置在您的LocalSettings.php 的底部:
    wfLoadExtension( 'WikiLove' );
  • 运行更新脚本,它将自动创建此扩展必须依赖的数据库表。
  • Yes 完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。

如果你想使用内置奖励,你必须启用 InstantCommons。 为此,请将其添加到 LocalSettings.php:

$wgUseInstantCommons = true;



  • $wgWikiLoveGlobal - 为所有的用户开启,用户可以在用户设置中关闭(默认不打开)。
    • Note: you can also enable the setting by default but still give the users the option to turn it off (opt-out) by using:
$wgDefaultUserOptions['wikilove-enabled'] = 1;
  • $wgWikiLoveTabIcon - 为支持它们的皮肤使用图标(即 Vector)(默认值:true
  • $wgWikiLoveLogging - 启用 WikiLove 捐赠的日志记录(默认值:false); 这会自动创建一个数据库表 wikilove_log,您可以将其用于统计查询
WikiLove 1.0 支持 MW 1.17+


要使您的帐户能够使用 WikiLove,请转到您首选项中的编辑选项卡,然后在“测试功能”(或者,在某些版本中,在 “常规选项” 下)打开 WikiLove。 In September 2022 this displays as "Enable showing appreciation for other users with the WikiLove tab".

要使用 WikiLove,请转到用户的讨论页(除您自己外)并单击心形图标。按照指示进行操作。


“要了解如何为单个编辑器(而不是整个 wiki)自定义 WikiLove,请参阅 user documentation。”

您可以通过编辑页面 MediaWiki:WikiLove.js 来自定义您自己的 wiki 的选项。 在这里,您可以像使用内置选项一样更改配置:defaultOptions.js。 以下是自定义 WikiLove 配置的一些示例:

The options at the top of defaultOptions.js are some default settings for your convenience. If you omit certain properties from types or subtypes, these defaults will be used (defaultText, defaultBackgroundColor, defaultBorderColor, defaultImageSize, defaultImage). Then there is the list of types. Each type can have the properties name (required) and icon (optional). Furthermore, a type can have a list of subtypes, or not, in which case the additional properties will be assigned to the type itself.

If the type has subtypes, they are listed in an object list subtypes. Optionally, the type can also have the property select, which specifies the label above the dropdown menu. Each subtype can have the following properties:

  • option - 下拉菜单中的名字
  • descr - Description of the subtype
  • header - Header of the message that is being added, i.e. the part that will be between == ... ==
  • title - 消息框的标题
  • text - 消息框的文字(详见下方)
  • image - 消息框的图片
  • gallery - Gallery for selecting an image (see below for details)
  • fields - Array of fields that the user can edit; can contain these values: header, title, image, message
  • imageSize - 图片大小(例如100px
  • backgroundColor - 背景颜色(任何CSS有效颜色,例如#fdffe7yellow
  • borderColor - 边框颜色(相同)

When not using subtypes, these options (except for the first two) should be added to the type itself.

In the text and email fields (as well as in defaultText, mentioned earlier), you can use a few codes that will be substituted automatically:

  • $1 - User message
  • $2 - Title
  • $3 - Image name
  • $4 - Image size
  • $5 - Background color
  • $6 - Border color
  • $7 - Username of the recipient

To make it easy for the user to select images, you can create a gallery with predefined images. For this, create a gallery property, which has the following properties:

  • imageList - An array of image names
  • width - Maximum width of the images in the gallery (in pixels); for 3 images 145 is recommended
  • height - Maximum height of the images in the gallery (in pixels)
  • number - Number of random images to show (optional); if omitted all images are shown

You can use images from Wikimedia Commons, as the default awards do. Like mentioned before, you have to enable InstantCommons for this.

Be sure to start your MediaWiki:WikiLove.js page with //<nowiki> and end it with //</nowiki> so that any Wikitext code (such as signatures or {{subst:foo}}) doesn't get expanded within the JavaScript.

Removing WikiLove types

If you just want to remove some of the default WikiLove types, you can delete them from the $.wikiLoveOptions object. Here are some examples that you could use in your wiki's MediaWiki:WikiLove.js page:

// Delete the Random Acts of Kindness Barnstar from the barnstars list
delete $.wikiLoveOptions.types.barnstar.subtypes.kindness;
// Delete the cheeseburger from the food and drink list
delete $.wikiLoveOptions.types.food.subtypes.cheeseburger;
// Delete the kittens interface entirely
delete $.wikiLoveOptions.types.kitten;

Adding new WikiLove types

Here's an example of adding a new puppy type:

$.wikiLoveOptions.types.puppy = {
	name: 'Puppy', // name of the type (appears in the types menu)
	fields: [ 'header', 'message' ], // fields to ask for in form
	header: 'You get a puppy!', // header that appears at the top of the talk page post (optional)
	text: '[[File:2009-08-16 Puppy at Duke East 1.jpg|left|150px]]\n$1\n\n~~'+'~~<br style="clear: both;"/>', // $1 is the custom message
	icon: 'http://www.mysite.com/images/wikilove-icon-puppy.png' // appears in the types menu

Here's an example of adding a new hedgehog type with a gallery of images to choose from:

$.wikiLoveOptions.types.hedgehog = {
	name: 'Hedgehogs', // name of the type (appears in the types menu)
	fields: [ 'header', 'message' ], // fields to ask for in form
	header: 'A hedgehog for you!', // header that appears at the top of the talk page post (optional)
	text: '[[$3|left|150px]]\n$1\n\n~~'+'~~\n<br style="clear: both"/>', // $3 is the image filename, $1 is the message
	gallery: {
		imageList: [ 'Hedgehog1.jpg', 'Orizo5.jpg', 'Erinaceus europaeus LC0119.jpg' ],
		width: 145, // maximum width of the images in the gallery
		height: 150, // maximum height of the images in the gallery
		number: 3 // number of random images to show (optional)
	icon: 'http://www.mysite.com/images/wikilove-icon-hedgehog.png' // appears in the types menu

Here's an example of adding a new falafel subtype under the existing food type:

$.wikiLoveOptions.types.food.subtypes.falafel = {
    fields: [ 'header', 'message' ], // fields to ask for in form
    option: 'Falafel', // option listed in the select list
    descr: 'Falafel is a popular Middle Eastern street food made from ground chickpeas or fava beans and topped with salads, vegetables, and sauces. It is typically served in a pocket of pita bread.',
    header: 'Some falafel for you!', // header that appears at the top of the talk page post (optional)
    image: 'Falafel award.png', // image for the item
    imageSize: '120px' // size to display image (optional)


If the talk page you are attempting to edit contains a word that has been subsequently added to Special:SpamRegex, attempts to use the interface to add a barnstar or other award will fail. This is because the page cannot be edited, as it contains a forbidden word. Removing the word from the page or from the filter will fix the problem.


WikiLove uses a special wikilove API to post messages to users' talk pages. The API is basically just a thin wrapper around some existing APIs. If the user's talk page is a Wikitext page, it uses the edit API. If it's a Flow page, it uses the flow API. And if it's a LiquidThreads page, it uses the threadaction API.

In order to call the API, use the parameter action=wikilove.


Title of the user or user talk page to send WikiLove to (required)
Raw wikitext to add in the new section (required)
Actual message the user has entered, for logging purposes (doesn't include the image and HTML formatting)
Edit token. You can get one of these through prop=info (required)
Subject header of the new page section (required)
Type of WikiLove (for statistics); this corresponds with a type selected in the left menu, and optionally a subtype after that (e.g. "barnstar-normal" or "kitten") (optional)
Content of the optional email message to send to the user




The WikiLove dialog upon first load
The WikiLove dialog upon selecting an award category
The WikiLove dialog upon filling out details for an award
The WikiLove dialog in preview mode
The hover state for the award selection pane

This document describes the design and behavior of the WikiLove system of positive feedback for Wikipedia. This tool is designed to promote the spread of WikiLove within Wikipedia. Specifically, it makes adding awards and gifts to user talk pages as simple as clicking a few buttons.


Wikipedia, as a community, has several mechanisms for indicating displeasure or to provide negative feedback to its users. Certain gadgets, such as Twinkle, are heavily engineered towards warning, blocking, and reverting.

Since Wikipedia is in need of positive reinforcement, especially for new users, a system designed specifically and only towards positive feedback is desired.


The system has a heavy style of "whimsy" to its design. This is intentional and is intended to align closer to the expectations of users of modern websites. Further, the entire principle of "awards" is in and of itself whimsical (e.g., cookies and kittens).

This style may be abandoned based on user feedback.


Some template types, such as welcome templates, are not technically "awards".

This document uses the term award interchangeably with template. Since the system is user-focused, and not intended directly for power-users, user-facing nomenclature has been used.



The WikiLove dialog is modal. Initiating it (from anywhere) will cause it to appear over the text of the page. It can be dismissed with a simple click.


The user will initially be presented with a short set of easy-to-understand instructions and a list of available award categories.

Upon selecting an award type, the user is presented with a section in which they can add details to the award (such as a short message).

Note that some award categories (e.g., "cookie") will not have a secondary award creation step and will go directly to "Preview".

The user then clicks the "preview" button, which will load a preview of the award so that they may see how it will look on the user's talk page.

Once the user is satisfied, they may click the "Send WikiLove" button. At this time, AJAX calls to the server API will be fired, adding the template to the user's talk page.


Since most new users are unlikely to be aware that they even have talk pages, they may not be aware that they have received the WikiLove in question.

Accordingly, the server will email the recipient (if they have provided an email address) informing them of the WikiLove as well as short instructions on how to access their talk page.


Initially, the awards that can be given are to be defined in the gadget itself. If this system is elevated to an extension, then the names of the awards and the templates should be defined in the site's LocalSettings.php.

Alternatively, such information can be stored in the database. An administration console would be required to add or subtract available awards and award categories.


For statistics gathering purposes, every time an award is given, data is tracked and stored in the database. A simple table, written to via the API, is all that need be required:

  • From User - The username of the person who is giving the award
  • To User - The username of the person receiving the award
  • Template - the name of the template awarded
  • Timestamp - when the award was given
  • Award Text - Optional; this would be the text of the award


In the future, it should be possible to create a page, Special:WikiLoveStatistics, that could be used to see how often the system is used as well as providing insight into who gives the most love, what awards are most popular, and who receives the most awards.

This will help to provide a global overview of community health. The more awards given, the healthier the community.


Phase two of this project could result in "Send WikiLove" links being dynamically added to signatures on talk pages. This would allow for WikiLove to be sent in a much easier manner, directly from other talk pages.