Like all other lively websites, MediaWiki is also a common target for spam bots. As soon you get backlinks and your website is listed on search engines, it becomes easy for spammers to find your website and use it for the promotion of their products or web content.
On an public wiki website, spams first create new user accounts and then bombard new wiki pages. Some wiki spammers edit pages to include advertising links to their websites whereas other spammers completely replaces the legitimate page content with their spam and links.
There are various methods of fighting with spam on a MediaWiki website. In this lesson we are discussing about the most powerful and dominant way of stopping spam user registrations on a wiki website.
Google ReCaptcha is a user-dialogue system that asks users to enter words visible in distorted text images. In general, it presents two words to protects websites from spam bots attempting to register account, publish comment or access restricted areas.
Implementing ReCaptcha In MediaWiki
You can easily add Google ReCaptcha using ConfirmEdit extension in your MediaWiki website.
It is the most popular MediaWiki captcha extension that allows you to choose from various different CAPTCHA techniques such as QuestyCaptcha, ReCaptcha, ReCaptcha (NoCaptcha), Are You A Human (aka PlayThru), SimpleCaptcha (calculation), FancyCaptcha, MathCaptcha etc.
The ConfirmEdit extension comes bundled in your MediaWiki download package but if in case it is not there, download it from here and then upload it to your wiki’s root /Extensions directory.
Now your next step is to open your LocalSettings.php file (located in your website’s root) and add this line of code:
require_once "$IP/extensions/ConfirmEdit/ConfirmEdit.php";
Visit here and obtain a public and private key for your MediaWiki website, all it takes is few seconds and three-four clicks.
require_once "$IP/extensions/ConfirmEdit/ReCaptcha.php"; wfLoadExtension( 'ConfirmEdit/ReCaptcha' ); $wgCaptchaClass = 'ReCaptcha'; $wgReCaptchaPublicKey = ''; $wgReCaptchaPrivateKey = '';
Now paste the given code in your LocalSettings.php file, adding your own API public and private keys in single quotes. That’s it. Also read: Enable Google Recaptcha On MediaWiki Create & Edit Page Options.