Extension:ContactPage

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
ContactPage

Release status:Extension status stable

MediaWiki-extensions-ContactPage.png
ImplementationTemplate:Extension#type Special page, Hook
DescriptionTemplate:Extension#description Provides a contact form for visitors
Author(s)Template:Extension#username Daniel Kinzler, Sam Reed
Latest versionTemplate:Extension#version 2.3 (2017-01-23)
MediaWikiTemplate:Extension#mediawiki 1.23+
PHPTemplate:Extension#php 5.4+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
README
ExampleTemplate:Extension#example nl.wikipedia.org
ParametersTemplate:Extension#parameters
  • $wgContactConfig
Hooks providedTemplate:Extension#newhook
ContactFormExtension:ContactPage/ContactForm
ContactFormBeforeMessageExtension:ContactPage/ContactFormBeforeMessage
ContactFromCompleteExtension:ContactPage/ContactFromComplete

Translate the ContactPage extension if it is available at translatewiki.net

Check usage and version matrix.
Vagrant roleMediaWiki-Vagrant#Using roles contactpage

IssuesPhabricator

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

Upgrading from versions < 2.x (MediaWiki ≤ 1.22) to versions ≥ 2.x (MediaWiki ≥ 1.23) requires a complete reconfiguration of this extension in "LocalSettings.php" to avoid breakage.

Installation and Configuration[edit]

  • Download and place the file(s) in a directory called ContactPage in your extensions/ 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
    	'AdditionalFields' => array(
    		'Text' => array(
    			'label-message' => 'emailmessage',
    			'type' => 'textarea',
    			'rows' => 20,
    			'cols' => 80,
    			'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 2.1, it is no longer possible to prefill text from MediaWiki:Contactpage-text-[form-name]. This feature has been removed in March 2014.
  • YesY 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
$wgCaptchaTriggers['contactpage'] = true;
to "LocalSettings.php" below the invocation of both extensions.
Note Note: The integration with the ConfirmEdit extension does not work for the REL1_23 tag. Thus this version has to be used for MW 1.23.x

Further customization[edit]

Adding a link to special page "Contact" to the footer of your wiki

To do this add ...

  1. ... 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;
    };
    
  2. ... the URL of "Special:Contact" to system message MediaWiki:Contactpage-url and
  3. ... the label for "Special:Contact" to system message MediaWiki:Contactpage-label.

See also[edit]