From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.svg

Release status:Extension status unmaintained

ImplementationTemplate:Extension#type User identity
DescriptionTemplate:Extension#description Adds KeyCAPTCHA to your MediaWiki
Author(s)Template:Extension#username KeyCAPTCHAtalk
Latest versionTemplate:Extension#version 1.0.0 (2012-04-06)
MediaWikiTemplate:Extension#mediawiki 1.16.x - 1.18.x
PHPTemplate:Extension#php 5.x
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GNU General Public License 2.0
Download External download
  • $wgKeyCaptchaPrivateKey
  • $wgKeyCaptchaID
Hooks usedTemplate:Extension#hook

Translate the KeyCAPTCHA extension if it is available at translatewiki.net

Check usage and version matrix.

KeyCAPTCHA is a visual CAPTCHA extension that relies on displaying a jigsaw puzzle graphic as either HTML5 or a Flash object. It detects which to use automatically.

The user must move the jigsaw puzzle pieces into position with the mouse to solve the CAPTCHA.

The extension depends on KeyCAPTCHA's server being available; it also requires the user enable JavaScript (and likely also Flash). It will render the new registration process less accessible (or utterly inaccessible) to users with "Lynx" style text browsers and to visually impaired users who rely on text-to-speech processors. Conversely, it renders the new user registration process far less accessible to spambots.

KeyCAPTCHA is a strict and effective Turing test but, unlike many other captchas, it does not require any text typing. Any text displayed as part of the KeyCAPTCHA graphic may be localised as one of twenty-eight languages worldwide.


  • Register on and log-in to www.keycaptcha.com
  • Add your site URL (and language) to the sites list (www.keycaptcha.com/member/sites)
  • Collect you ID and your private key.
  • Download, extract and place the file(s) in a directory called keyCaptcha in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/keyCaptcha/keyCaptcha.php";
    $wgKeyCaptchaPrivateKey = 'xxxxthisissecretdontpeekxxxx';
    $wgKeyCaptchaID = '99999';
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

MediaWiki 1.27+[edit]

The extension code supplied by https://www.keycaptcha.com/media/plugins/keycaptcha-for-mediawiki-116x-118x.zip contains a call to wfGetIP(), a function which was deprecated in MediaWiki 1.19 and removed completely in MediaWiki 1.27.

This will break your KeyCaptcha installation in the current MediaWiki release. One possible solution is to add this stub function to LocalSettings.php:

# stub functions to restore deprecated wfGetIP() and wfMsg($x) - use this for MW 1.27 and later only
function wfGetIP() 
	global $wgRequest;
	return $wgRequest->getIP();

There are also multiple message functions which are breaking due to MediaWiki changes; see Manual:Messages API#Help with replacing deprecated wfMsg* functions.

function wfMsg($txt)
        return wfMessage($txt)->text();

function wfEmptyMsg($key, $message)
        return wfMessage( $key )->inContentLanguage()->isBlank();

(The stub functions are a kludge which would - or should - go away if and when KeyCaptcha updates the original extension to match the current MediaWiki environment. See also task T149727.)

Known bugs and issues[edit]

  • The extension version https://www.keycaptcha.com/media/plugins/keycaptcha-for-mediawiki-116x-118x.zip calls an undefined method keyCaptcha::buildRegexes() in ...extensions/local/keyCaptcha/keyCaptcha.php on line 69. As the extension is based on the ConfirmEdit code, which is distributed with MediaWiki, a buildRegexes definition should be available in MW sources (most likely /extensions/SpamBlacklist/buildRegexes/SpamRegexBatch.php). Another possible workaround is to replace:
$whitelist = wfEmptyMsg( 'captcha-addurl-whitelist', $source ) ? false : $this->buildRegexes( explode( "\n", $source ) );

with simply:

$whitelist = false;

Configuration options[edit]

Each domain may be configured to support charity funds by enabling social advertising in KeyCAPTCHA, to earn money by displaying commercial advertising, both or no advertising at all:

  1. Anti-spam protection. Social advertising. Monetization through commercial ads.
  2. Anti-spam protection. Monetization through commercial ads.
  3. Anti-spam protection. Social advertising.
  4. Anti-spam protection without any ads.

The branding of KeyCAPTCHA itself cannot be removed from the free version of the service; additional customisation is available in a paid version. All of these options (as well as language and topic of your website) are configured from KeyCAPTCHA's website on a per-domain basis.