Extension:ContactPage
ContactPage Release status: stable |
|
---|---|
![]() |
|
Implementation | Special page , Hook |
Description | Provides a contact form for visitors |
Author(s) | Daniel Kinzler, Sam Reed |
Latest version | Continuous updates |
Compatibility policy | release branches |
MediaWiki | 1.25+ |
PHP | 5.4+ |
Database changes | No |
License | GNU General Public License 2.0 or later |
Download | README |
Example | nl.wikipedia.org |
|
|
Translate the ContactPage extension if it is available at translatewiki.net | |
Vagrant role | contactpage |
Issues | Open tasks · Report a bug |
The ContactPage extension implements a contact form for visitors. It creates a special page "Special:Contact", which is similar to "Special:EmailUser", but it has a fixed recipient, and may be used without registering.
Installation and ConfigurationEdit
- Download and place the file(s) in a directory called
ContactPage
in yourextensions/
folder. - Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'ContactPage' ); $wgContactConfig['default'] = array( 'RecipientUser' => 'WikiUser', // Must be the name of a valid account which also has a verified e-mail-address added to it. 'SenderName' => 'Contact Form on ' . $wgSitename, // "Contact Form on" needs to be translated 'SenderEmail' => null, // Defaults to $wgPasswordSender, may be changed as required 'RequireDetails' => true, // Either "true" or "false" as required 'IncludeIP' => true, // Either "true" or "false" as required 'MustBeLoggedIn' => true, // Check if the user is logged in before rendering the form 'AdditionalFields' => array( 'Text' => array( 'label-message' => 'emailmessage', 'type' => 'textarea', 'rows' => 20, 'required' => true, // Either "true" or "false" as required ), ), // Added in MW 1.26 'DisplayFormat' => 'table', // See HTMLForm documentation for available values. 'RLModules' => array(), // Resource loader modules to add to the form display page. 'RLStyleModules' => array(), // Resource loader CSS modules to add to the form display page. );
- See the README file for further options to customize and adapt as it convenes. Note, however, that since March 2014, it is no longer possible to prefill text from
MediaWiki:Contactpage-text-[form-name]
. - Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
To users running MediaWiki 1.27 or earlier:
The instructions above describe the new way of installing this extension using wfLoadExtension()
.
If you need to install this extension on these earlier versions (MediaWiki 1.27 and earlier), instead of wfLoadExtension( 'ContactPage' );
, you need to use:
require_once "$IP/extensions/ContactPage/ContactPage.php";
You can require a CAPTCHA test for the contact page, if you have the ConfirmEdit extension installed. CAPTCHAs are enabled by adding to "LocalSettings.php" below the invocation of both extensions.
$wgCaptchaTriggers['contactpage'] = true;
Further customizationEdit
- Adding a link to special page "Contact" to the footer of your wiki
To do this add ...
- ... the following code without changing it to your "LocalSettings.php" file:
$wgHooks['SkinTemplateOutputPageBeforeExec'][] = function( $skin, &$template ) {
$contactLink = Html::element( 'a', [ 'href' => $skin->msg( 'contactpage-url' )->escaped() ],
$skin->msg( 'contactpage-label' )->text() );
$template->set( 'contact', $contactLink );
$template->data['footerlinks']['places'][] = 'contact';
return true;
};
- ... the URL of "Special:Contact" to system message MediaWiki:Contactpage-url and
- ... the label for "Special:Contact" to system message MediaWiki:Contactpage-label.
- Creating more complex forms
See HTMLForm and related pages for more information on the possibilities available to create more complex forms.
This extension is being used on one or more Wikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia's CommonSettings.php and InitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki's Special:Version page. |