InMotion Hosting Support Center

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.
    $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.


Was this article helpful?
Continued Education in Course 104: Adding a contact form in MediaWiki
You are viewing Section 3: How to enable reCAPTCHA in MediaWiki
Section 2: This user has not specified a valid e-mail address error: MediaWiki

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Support Center Login

Our Login page has moved. Please click the button below to be redirected to the login page.

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

0 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


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:
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!