Configuring the ContactPage Extension in MediaWiki

When setting up a MediaWiki site, you may want to allow visitors who are not registered or authenticated in your MediaWiki site to contact you for various reasons. An example of this is, if your MediaWiki site is only editable by a few people, you can have a contact page for visitors to email you if there are any website errors or misinformation on your site. This article will explain how to download, install, and configure the MediaWiki ContactPage extension.

Download the MediaWiki ContactPage extension

The ContactPage Extension is a free plugin you can get online at the WikiMedia code site. You can access it directly from the link below.

ContactPage Extension Download page.

If the link is not accessible, you can follow the steps below to get the ContactPage extension files. The version of this Extension changes frequently, so you can go directly to the WikiMedia code base to find a newer version. Below are the steps to obtain the files needed to install the MediaWiki ContactPage extension.

  1. Click browse code ContactPage MediaWiki

    Go to https://www.mediawiki.org/wiki/Extension:ContactPage and click the “browse code link in the Download section.

  2. Click tree next to the version ContactPage MediaWiki

    At the MediaWiki code review site, click “tree next to the version right below below the “master” version.

  3. Click the raw link ContactPage MediaWiki

    You will be directed to the “Code Review / mediawiki/extensions/ContactPage.git / tree” page. Click the “raw” link next to each file to download the PHP files to your local computer.

    Note! You do not need to download the .gitignore, .gitreview, README, and install.settings files as these are not needed.


    Save files to your computer ContactPage MediaWiki

    Save each PHP file to your computer.

    You should have the following files on your local computer.

    ContactPage.alias.php ContactPage.i18n.php ContactPage.php ContactPage_body.php 


Installing the MediaWiki ContactPage extension

Once you have downloaded all the necessary files for the ContactPage Extension to work, you will need to upload and configure the ContactPage extension. Below are the steps to upload and enable the ContactPage extension for MediaWiki.

  1. Login into your cPanel.
  2. Go to the File Manager. Select your MediaWiki installation directory and click Go.
  3. Navigate to your MediaWiki extensions folder. The path should look similar to the following.
    public_html/mediawiki/extensions

    Create a folder called “ContactPage” in the extensions folder.


  4. Directory of files ContactPage MediaWiki

    Upload your ContactPage extension php files to the extensions directory like so it looks like the snapshot to the right.

    Note! You do not need to upload the .gitignore, .gitreview, README, and install, settings files as these are not needed.


  5. Next, Navigate to the LocalSettings.php file in your MediaWiki root directory.

    Select the LocalSettings.php and edit it with the code editor.


  6. View of the code for ContactPage MediaWiki

    Place the following code at the bottom of your LocalSettings.php file.

    require_once( "$IP/extensions/ContactPage/ContactPage.php" );   $wgContactUser = 'Admin'; $wgContactSender = $wgPasswordSender; $wgContactSenderName = 'Contact Form on ' . $wgSitename;

    Save the changes.


  7. Special pages in ContactPage MediaWiki

    Now Log into MediaWiki and click “Special” pages on the left hand side. On the “Special pages” page, the Contact page will be listed in the “Other special pages.”

    No Email Error ContactPage MediaWiki

    Important! If your email for the admin is not set up and authenticated, you will need to confirm the email address in your Admin user preferences. Otherwise you will get a “No e-mal address” error on the contact page. For more information on this please see our article on This user has not specified a valid e-mail address error: MediaWiki.

    View of the contact form ContactPage MediaWiki

    As long as your email address is set up for your admin, you should see the contact form look like the snapshot to the right.


ContactPage Extension Configuration settings

The ContactPage Extension can have a few different configuration settings for customizing the form. Each setting can be added to your LocalSettings.php to enable or disable the setting. Below is a table with the available Configuration code settings.

MediaWiki ContactPage Extension Configuration
$wgUserEmailUseReplyToCan be set to true of false. This will use the visitor’s email address as the “Reply-To” address.

Syntax: $wgUserEmailUseReplyTo[‘contactpage’] = true;

$wgContactUserThis is set to a string of Characters. This is the username of an account in your MediaWiki that has an enabled and authenticated email address. In this example we use the Admin users email address. The email must be configured in the users Preferences. For more information on how to configure the email in the user preferences, please see our article on This user has not specified a valid e-mail address error: MediaWiki.

Syntax: $wgContactUser = ‘Your text goes here’;

$wgContactSenderUses the email address of the $wgContactUser for the form submittal.

Syntax: $wgContactSender = $wgPasswordSender;

$wgContactSenderNameThis is set to a string of Characters. This will display the name in the email of the receiving email address.

Syntax: $wgContactSenderName = ‘Your text goes here’;

$wgContactRequireAllCan be set to true of false. If this is set to true, the contact form will require the fields in the form to be filled out. The default is False.

Syntax: $wgContactRequireAll[‘contactpage’] = true

$wgContactIncludeIPCan be set to true of false. Enables a checkbox in the contact form that allows the senders IP address to be included in the email.

Syntax:$wgContactIncludeIP[‘contactpage’] = true;

$wgCaptchaTriggersEnables the captcha in the contact form.

Important! This will not work unless reCAPTCHA is enabled. For information on enabling reCAPTCHA in MediaWiki, please see our article on How to enable reCAPTCHA in MediaWiki.

Syntax:$wgCaptchaTriggers[‘contactpage’] = true;

Was this article helpful? Join the conversation!