This page is a translated version of the page Extension:Emoticons and the translation is 0% complete.
Other languages:
English • ‎dansk • ‎日本語

MediaWiki extensions manual
OOjs UI icon advanced.svg
Release status: stabil
BlueSpice Mediawiki Extension Emoticons.png
Beskrivelse Enable forum-style emoticon (smiley) replacement within MediaWiki.
Forfatter(e) Markus Glaser, Alex Wollangk (alex@wollangk.com) and Techjar (tecknojar@gmail.com)
Maintainer(s) Hallo Welt! GmbH
Latest version 3.1.7 (2020-06-10)
Compatibility policy LTS release branches
MediaWiki 1.31 (LTS)
Licens GNU General Public License 3.0 only
Eksempel en.demo.bluespice.com
Translate the Emoticons extension if it is available at translatewiki.net
Check usage and version matrix.
Issues Open tasks · Report a bug

This extension makes forum-style emoticon (smiley) replacements within MediaWiki. See the list of emoticons below.


  • Download and place the file(s) in a directory called Emoticons in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'Emoticons' );
  • Create the page "MediaWiki:Emoticons"
  • Add one line to this page for each emoticon. Each line contains the text to be replaced followed by "//" followed by the text to replace it with.
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Sample MediaWiki:Emoticons

Here is a sample list of emoticons:


About the Code

(If you don't care about how this extension was written, ignore the following section.)

When writing this extension the biggest challenge I had was accessing the MediaWiki:Emoticons article. I wanted to use the existing framework rather than use SQL to help insure that it would continue to work even if the database structure is updated. A fair amount of searching did not come up with many hints on how to do this, however. At one point I tried to access the article through the global $mediaWiki object, but that object has not been instantiated when LocalSettings.php is included and so extensions do not have access to it. I finally made the decision to manually instantiate an "Article" which requires instantiating a "Title" and use that "Article" to load the appropriate page.

A few other notes:

  • I started out referring to the MediaWiki namespace using the NS_MEDIAWIKI constant, but saw a reference that said that this constant would not work in non-english Wikis and so used the integer '8' instead.
  • I disabled emoticon replacement in most actions other than just viewing the page to keep things dynamic. If the replacement is done when editing a page the substitution will happen to the text in the textarea so that the replaced text will end up in the database. At that point if that emoticon is updated, since the original text was replaced, that page will not reflect the new emoticon.
  • I saw a suggestion made to a different programmer that instead of accessing the "m" fields that they use the associated getter and setter function. In several cases I am accessing the "m" fields as well, but this is only because I could not find a related getter or setter in the code documentation.
  • Since the values are trimmed before replacements are made, if you want to replace text ending with a forward slash ("/") or replace something with text beginning with a forward slash, all you need to do is put a space between the double forward slashes used as a separator and the forward slash in the search or replacement text. If you want to replace text ending with two double slashes replace something with text beginning with two double slashes, you need to come up with a different separator. Once you have figured out what you want to use, make sure you are using it in the MediaWiki:Emoticons file and replace the "//" in extensions/emoticons.php (in: "$currEmoticon = explode( "//", $emoticon, 2 );") with that separator as well.
  • This extension may be useful if you want to do other replacements as well, but be careful as it will replace any instance of the search text before other wiki formatting gets a chance to run, unless you wrap it in <nowiki> and </nowiki> tags (although only 10 of these are respected for load-time reasons). For instance, if you set up ":D" to be replaced with a smiley face and somewhere in the wiki someone wants to indent a line beginning with "D" like this ":Details of this transaction..." it will be rendered as a big smiley followed by "Details of this transaction..."

External links

This extension was originally made for BlueSpice. BlueSpice is a MediaWiki distribution for enterprises and organizations. It enhances MediaWiki, in particular in the areas of quality management, process support, administration, editing and security.

You can download this extension separately.

BlueSpice: Portal - Website - Demo - Helpdesk - BlueSpice free download - Setup Portal - News - Twitter