Installing a Contact form on your DokuWiki site can be somewhat complex. DokuWiki does not have any contact form capability built into their software. In order for you to get a contact form on your DokuWiki site, you will need to use a plugin. This tutorial will explain how to use the Modern Contact plugin for DokuWiki.
Steps to use the Modern Contact plugin
Download and Install the plugin
In order to create a contact form in your wiki you will need to use the Modern Contact plugin. The following explains where to download and how to install the plugin.
Visit the following url where the plugin can be downloaded from.
https://www.dokuwiki.org/plugin:contactmodern
Click the Download link.
Get the URL for the plugin. You can right click the download link and copy the Link Location or get the link from the browser address bar. The link for the plugin should look like the following.
https://github.com/downloads/marvinrabe/dokuwiki-contact/moderncontact_2012-06-06.zip
Click the Admin link at the top right side.
Select the “Manage Plugins” link.
Paste the URL you obtained from the plugin download site in the “Download and install a new plugin” box.
Click Download.
You should see a green confirmation saying, “Plugin package (2 plugin(s
): __MACOSX,moderncontact) successfully installed“.Now the plugin will show in the “Installed plugins” list.
Add Modern Contact plugin code
Once you have the Modern Contact plugin installed, you can add the code to your wiki page that is designed to store your Contact form. The following are example codes you can use in your wiki Contact page.
{{contact>}}
{{contact>subj=Contact the Developer}}}
{{contact>to=Admin|subj=Contact the Developer}}
The table below has a brief description of the attributes available for the contact form code.
Attribute | Description |
---|---|
subj | This will allow the subject to be specified in the form removing the subject input from the contact form. |
to | The username can be specified here for having a specific user receive the email from the form. |
captcha | This can be set to True or False. True will display the reCAPTCHA and false will hide it. |
Below are the steps to add the code to your wiki page.
- Find the page you want to add the contact form to and edit it.
To have the basic form display, add the following code to your page.
{{contact>}}
Save the changes.
Before the contact form will display on your page, you will need to fix the code in the plugin. The following will explain how to fix the plugin code.
Fixing the Modern Contact plugin code
To fix the code, we will need to “find and replace” a specific code in one of the files of the plugin. This is because the plugin developers have not created a fix for a bug in the plugin.
Important! When using find and replace, its important to make sure you typed the words correctly and that you have a backup of the plugin. Find and replace cannot be undone so be careful.
Below are the steps to take for finding and replacing the code to make the Modern Contact form to work.
- Login into your cPanel.
- Go to the File Manager. Select your DokuWiki installation directory and click go.
- Navigate to the following file location.
lib/plugins/moderncontact/syntax.php
Open the file in the code editor.
Press Ctrl + F on your keyboard to open the find and replace box. Find and replace the following code:
contactmodern
Replace it with the following:
moderncontact
Open the file in the code editor.
Save the changes.
Configure the Modern Contact plugin Settings
In order for the Contact form to work completely, you will need to configure the plugin. You can get a “reCAPTCHA” key from Google to have the “reCAPTCHA” work on your form. The below steps will explain how to configure the Modern Contact plugin.
For more information on the Google “reCAPTCHA” private and public keys, please see our article on How to get the public and private keys for Google reCAPTCHA.
- Log into DokuWiki.
- Click the Admin link at the top right.
Select the Configuration Manager.
Scroll to the bottom where it has the Moderncontact Plugin Settings.
Here is where you configure the plugin. You can change the default email address for the contact form and enable the captcha here. This is where you will use your Google “reCAPTCHA” public and private keys.
Save the changes.
Now when you visit the page where you placed the contact form code, you will see the basic contact form show.