-
Notifications
You must be signed in to change notification settings - Fork 5
Github mirror of MediaWiki extension ContactPage - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
License
wikimedia/mediawiki-extensions-ContactPage
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
-------------------------------------------------------------------------- README for the ContactPage extension Copyright © 2006-2014 Daniel Kinzler, Sam Reed Licenses: GNU General Public Licence (GPL) GNU Free Documentation License (GFDL) -------------------------------------------------------------------------- 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 can be used anonymously. <https://www.mediawiki.org/wiki/Extension:ContactPage> The ContactPage extension was originally written by Daniel Kinzler in 2007 and is released under the GNU General Public Licence (GPL). It is based on the code in SpecialEmailuser.php in the MediaWiki core. The internationalization files contain contributions by several people; they are mentioned in each file individually. == Installing == Copy the ContactPage directory into the extensions folder of your MediaWiki installation. Then add the following lines to your LocalSettings.php file (near the end): wfLoadExtension( 'ContactPage' ); == Configuration == As of version 2, all configuration is done by one global variable, $wgContactConfig. $wgContactConfig['formname'] = [ 'RecipientUser' => 'WikiUser', 'SenderEmail' => '[email protected]', 'SenderName' => 'User Email', 'RequireDetails' => true, 'IncludeIP' => true, 'MustBeLoggedIn' => true, 'NameReadonly' => true, 'EmailReadonly' => true, 'SubjectReadonly' => true, 'MustHaveEmail' => true, 'AdditionalFields' => [], 'FieldsMergeStrategy' => null, 'RLModules' => [], 'RLStyleModules' => [], ]; All contact form keys (in this case 'formname') should be in lowercase. The following situations will cause the contact form to be inaccessible: * Setting EmailReadonly to true if MustBeLoggedIn is false and RequireDetails is false. * Setting MustHaveEmail to true if MustBeLoggedIn is false. * RecipentUser and RecipientEmail being undefined. One of RecipientUser or RecipientEmail should be defined. If using RecipientUser, it must be the username of a registered wiki user, who has supplied an email address, has user-to-user email enabled, and has confirmed his/her email address if that is required on this wiki (see $wgEmailAuthentication). If using RecipientEmail, it should be a valid email address. SenderEmail is used when to send the email when an address isn't entered on the contact form. It defaults to $wgPasswordSender. SenderName is the display name used with SenderEmail. RequireDetails is whether the users will be required to supply a name and an email address on Special:Contact. IncludeIP is used to decide whether the form will include a checkbox offering to put the IP address of the submitter in the subject line. MustBeLoggedIn is whether the contact form is only accessible when users are logged in. NameReadonly is used to make the name field readonly. EmailReadonly is used to make the email field readonly. SubjectReadonly is used to make the subject field readonly. MustHaveEmail is used to require that the user loading the form has a confirmed email address attached to their account. If the user does not have a confirmed email address, an error will be displayed and the form will not be shown. AdditionalFields is used to add any additional fields to the contact form. These are done using https://www.mediawiki.org/wiki/HTMLForm notation. The default message text box is not included by default, and if required, should be added manually to the AdditionalFields array like below. It should be noted that type 'selectandother' is not currently supported. 'AdditionalFields' => [ 'Text' => [ 'label-message' => 'emailmessage', 'type' => 'textarea', 'rows' => 20, 'cols' => 80, 'required' => true, ], ], FieldsMergeStrategy defines how fields defined in `AdditionalFields` are merged with extension-defined fields. It currently accepts only two values with the following semantic: 1. null (default). In default mode, some fields such as FromName, and FromAddress are unconditionally defined by the extension and placed in a fixed location. Configured forms cannot remove them nor influence their placement locations. 2. The string 'replace'. With this option, the configured form can redefine some fields already defined by the extension for the purpose of controlling their placement position in the form or hiding them completely. Example: Let's say we want to have a very important field as the first field of the form. 'AdditionalFields' => [ 'ImportantField' => [ 'label' => 'This field must be the first field of the form!', 'type' => 'textarea', ], ], In default mode, this field will appear as the fourth field of the form (instead of the location we wanted), because the extensions defines 3 other fields unconditionally and placed ours below them. With `FieldsMergeStrategy` option, it's possibly to make our 'very important' field as the first field in the form. 'AdditionalFields' => [ 'ImportantField' => [ 'label' => 'This field must be the first field of the form!', 'type' => 'textarea', ], 'FromName' => [ 'label-message' => 'contactpage-fromname', 'type' => 'text', 'required' => true, 'default' => null, 'disabled' => false, ], ], All the these fields will now appear in the order we defined them. Any non-redefined field will retain their extension-defined order. Setting any of these fields to null will remove them completely. Note 1: Field attributes defined in 'AdditionalFields' take precedence over the following 4 global attributes in form configuration: $wgContactConfig['formname'] = [ 'RequireDetails' => true, // This sets `FromName` and `FromAddress` // as required fields. 'NameReadonly' => true, // This sets `FromName` as readonly. 'EmailReadonly' => true, // This sets `FromAddress` as readonly. 'SubjectReadonly' => true, // This sets `Subject` as readonly. ]; If FieldsMergeStrategy is 'replace', these will not automatically apply for any field that's redefined. But you can set any of them explicitly on the field. Example: 'FieldsMergeStrategy' => 'replace', 'AdditionalFields' => [ 'ImportantField' => [ 'label' => 'This field must be the first field of the form!', 'type' => 'textarea', ], 'FromName' => [ // FromName is redefined. 'label-message' => 'contactpage-fromname', 'type' => 'text', 'required' => true, // This takes precedence over 'RequireDetails' 'default' => null, // null means extension should populate it 'disabled' => false // This takes precedence over 'NameReadOnly' ], ], Note 2: Some special control fields (where applicable) such as the Captcha form, Email copy and IPAddress checkboxes cannot be redefined or moved. RLModules can be used to add ResourceLoader modules (custom CSS and JavaScript) to the page. RLStyleModules can be used to add ResourceLoader CSS modules to the page. == Customization == [[Special:Contact]] calls the 'default' form. Pagetext: [[MediaWiki:contactpage-pagetext]] Subject: prefilled with text from [[MediaWiki:Contactpage-defsubject]] E-mail body: empty. [[Special:Contact/typename]] calls the contact page with a customized pagetext and prefilled form fields: Pagetext: [[MediaWiki:contactpage-pagetext-typename]] Subject: prefilled with text from [[MediaWiki:contactpage-subject-typename]] E-mail body: prefilled with text from [[MediaWiki:contactpage-text-typename]] If a customized message does not exist the default message is shown.
About
Github mirror of MediaWiki extension ContactPage - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
Resources
License
Code of conduct
Stars
Watchers
Forks
Packages 0
No packages published