Extension:reCAPTCHA

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
reCAPTCHA

Release status: stable

Implementation User identity
Description Places a strong CAPTCHA (including audio CAPTCHA) on your Wiki
Author(s) reCAPTCHA
License MIT License[1]
Download code.google.com

Check usage (experimental)

Contents

[edit] What can this extension do?

reCAPTCHA places a strong CAPTCHA on your wiki. The CAPTCHA helps to read books that are scanned by projects such as archive.org. The CAPTCHA also includes an accessible audio version. Researchers at Carnegie Mellon University believe that this CAPTCHA is not readable by current OCR technology.

Requires MediaWiki 1.8 or above.

[edit] Usage

See https://www.google.com/recaptcha/admin/create?app=mediawiki for instructions on getting your own recaptcha keys.

Install the extension from http://code.google.com/p/recaptcha or install the ConfirmEdit extension, which includes it.

[edit] Configuration

The following set of rules strikes the right balance between keeping spam down and allowing unrestrictive access to users:

  1. Any user can edit the wiki, because registration puts people off.
  2. Unregistered users are always presented with a captcha.
  3. Registration requires a captcha.
  4. Registered users are never presented with a captcha.

In the MediaWiki config those rules looks like this:

// Fix the default captcha behaviour
$wgGroupPermissions['*'            ]['skipcaptcha'] = false;
$wgGroupPermissions['user'         ]['skipcaptcha'] = true;
$wgGroupPermissions['autoconfirmed']['skipcaptcha'] = true;
$wgGroupPermissions['bot'          ]['skipcaptcha'] = true; // registered bots
$wgGroupPermissions['sysop'        ]['skipcaptcha'] = true;
 
$wgCaptchaTriggers['edit']          = true;
$wgCaptchaTriggers['create']        = true;
$wgCaptchaTriggers['createaccount'] = true;

(all other permissions having their default values)

[edit] Troubleshooting

[edit] Problem locating keys

If after defining in your LocalSettings.php your $recaptcha_public_key and $recaptcha_private_key you get the following error code,

You need to set $recaptcha_private_key and $recaptcha_public_key in LocalSettings.php to use the reCAPTCHA plugin.

then you must put your $recaptcha_public_key and $recaptcha_private_key definition after

require_once( "$IP/extensions/recaptcha/ReCaptcha.php" );

[edit] Captcha box layout messed in RTL languages (hebrew)

ReCaptcha was designed for LTR. Until a verion that supports RTL is officially released, the quick and dirty solution is to make the following change in recaptchalib.php:

(1) Go to function recaptcha_get_html (line 124 in version 1.7)

(2) Change return so that it is wrapped in a div dir="ltr" tag

[edit] Parameter 1 to ReCaptcha::confirmEdit() expected to be a reference

Under PHP 5.3.2 and recaptcha-mediawiki-1.7 you may see the following error.

Warning: Parameter 1 to ReCaptcha::confirmEdit() expected to be a reference,
value given in [...]/includes/Hooks.php on line 117

This can be fixed by applying the following patch (see Manual:Hooks/EditFilter).

--- ConfirmEdit.php  2010/06/04 16:08:21     1.1
+++ ConfirmEdit.php   2010/06/04 16:08:27
@@ -483,7 +483,7 @@
         * @param string $section
         * @param bool true to continue saving, false to abort and show a captcha form
         */
-     function confirmEdit( &$editPage, $newtext, $section ) {
+     function confirmEdit( $editPage, $newtext, $section ) {
                if( $this->shouldCheck( $editPage, $newtext, $section ) ) {
                        if( $this->passCaptcha() ) {
                                return true;
--- ReCaptcha.php     2010/06/04 16:04:15     1.1
+++ ReCaptcha.php     2010/06/04 16:04:19
@@ -97,7 +97,7 @@
          * Called on all edit page saves. (EditFilter events)
          * @return boolean - true if page save should continue, false if should display Captcha widget.
          */
-        function confirmEdit( &$editPage, $newtext, $section ) {
+        function confirmEdit( $editPage, $newtext, $section ) {
                 if( $this->shouldCheck( $editPage, $newtext, $section ) ) {
 
                         if (!isset($_POST['recaptcha_response_field'])) {

[edit] Notes

reCAPTCHA relies upon, and is bundled with, the ConfirmEdit extension. Its version may be out-of-date, however, so grab a fresh copy if you have problems.

[edit] References

  1. Google Code page
Language: English  • Русский
Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox