To prevent spam bots and robots from filling your MediaWiki pages with spam links and unwanted content, you can have the "reCAPTCHA" enabled in your MediaWiki LocalSettings.php to prevent bots from editing your pages. ReCAPTCHA is a free service from Google that allows you to add a verification box to determine if the page is being edited by a human or not. ReCAPTCHA uses a public and private key to create different words required for the image. Form pre information on reCAPTCHA please see our article on How to get the public and private keys for Google reCAPTCHA.

Adding reCAPTCHA to your WIKI edit sections

  1. Login into your cPanel.
  2. Go to the File Manager. Select your MediaWiki installation directory and click Go.
  3. Find the LocaSettings.php file and open it with the code editor.
  4. Code view of reCAPTCHA code MediaWikiAdd the following lines at the end of your LocalSettings.php file.
    require_once("$IP/extensions/ConfirmEdit/ReCaptcha.php"); 
    $wgCaptchaClass = ReCaptcha;
    $wgReCaptchaPublicKey = 'Your captcha public key';
    $wgReCaptchaPrivateKey = 'Your captcha private key';

    This code will link your Edit pages to the reCAPTCHA in your ConfirmEdit file.

    Add the following code below the reCAPTCHA code. This code gives permission to users where they get the captcha or not. Also, it enables the reCAPTCHA for specific features. In this case the edit, create, createaccount, and contactpage all will have the reCAPTCHA on it.

    $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;
    $wgCaptchaTriggers['contactpage'] = true; // Adds reCAPTCHA to the contact page if created

    Save the changes.


    Preview of the reCAPTCHA in MediaWikiNow when someone that is not logged into your MediaWiki site tries to submit a change to your pages, the reCAPTCHA will display like the image to the right.

    Important! When editing pages in your MediaWiki, the reCAPTCHA will not display until you click the save button. After you click the save button, the reCAPTCHA will appear at the top with a warning.


     

Like this Article?

Login to comment.

Your Opinion Matters

... but we need to know what you're thinking!

I'm James Richardson, your friendly Community Support technician, and I wrote the article you're looking at now. I like to think it's perfect, but I'm sure you have some suggestions. Please, let me know what they are!

Feedback
Your Email Address
Because we'd like to talk with you!

Latest Questions

If you need some help, submit your question to our Community!
We guarantee a response within 60 minutes (8am - 9pm EST, Monday - Friday)
Ask a Question!
Recent Questions
  1. I can't access my website
  2. we-creation.com server down
  3. How do I delete the DNS entry?

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!