PmForm

(redirected from PmForm.Installation)

This group is used to document the Cookbook:PmForm recipe.

From PmWiki 2.3.22, the script and the template pages are included in the core, you don't need to download it separately. It is not enabled by default, you still need to enable and configure it, see below.

There are several steps for PmForm to work.

  1. For PmWiki 2.3.22 or more recent:
    1. Modify your local/config.php or other local customization file, enabling PmForm
      include_once("$FarmD/scripts/pmform.php");
  2. For PmWiki 2.3.21 or older:
    1. Download pmform.zip and extract it to your PmWiki directory on your server
    2. Modify your local/config.php or other local customization file, enabling PmForm
      include_once("$FarmD/cookbook/pmform.php");
  3. add a line in your config.php file to define the reference for every unique (:pmform reference:) directive:
    $PmForm['reference'] = 'subject="Email from '.$WikiTitle.'" mailto=yourname@example.com form=#yourform fmt=#yourformpost from=myname@myexample.com';
  4. Create wiki page called Site.LocalTemplates if it doesn't exist already
  5. Modify Site.LocalTemplates, editing the form code creating the form (named #yourform from the config.php line above) and the output format (named #yourformpost from the config.php line above)
  6. Inserting the (:pmform reference:) directive into any wiki page where you want this specific form

If your wiki is sending you email forms with international characters, and the character encoding of the emails is wrong, you may also want to add the following to config.php:

# Fix for Subject header, if international characters:
$EnablePmFormMailSubjectEncode = 1;

# Fix for message body:
$PmFormMailHeaders = "Content-Type: text/plain; charset=utf-8\r\n";

Starting points:

  • Basic Email Form - a walkthrough creating a basic email form with honeypot & captcha (by Xes)
  • MailForm - forms for sending electronic mail
    • GDPR MailForm - forms for sending electronic mail, GDPR compliant
  • HoneyPot - filter posts from robots
  • Comments - Add comments to current page, or a comment page
    • GDPR Comments - Add comments to current page, or a comment page, GDPR compliant
  • Data Forms - Add data to pages

Unofficial user's notes about PmForms:

Notes

You need to put pmform.php direct into your cookbook/ directory, and Site.PmFormTemplates into your wikilib.d directory.

  • Xes: I don't recommend putting Site.PmFormTemplates directly in wikilib.d because that's part of the upgrade tree and should not be modified by users or recipes. I created my own xeslib.d directory and put Site.PmFormTemplates into it, adding this as the very FIRST line in my config.php:
    $WikiLibDirs = array(&$WikiDir,new PageStore('$FarmD/xeslib.d/{$FullName}'),new PageStore('$FarmD/wikilib.d/{$FullName}'));
    This is how you can create your own lib (library) directory ("lib.d") name for wiki page templates separate from user-overwritten wiki.d files.
  • ChrisK: Any installation of files into wikilib.d also runs into issues with using WikiFarms where the wikilib.d directory may not have permissions allowing it to be written to. It thus seems reasonable to move the Site.PmFormTemplates file to the wiki.d directory.

All relevant pages in the PmForm group:

Category: Forms
 0: 00.00 00.00 config start
 1: 00.01 config end
 2: 00.20 MarkupToHTML begin
 3: 00.23 ReadApprovedUrls SiteAdmin.ApprovedUrls begin
 4: 00.23 ReadApprovedUrls SiteAdmin.ApprovedUrls end
 5: 00.24 FPLTemplate: Chain begin
 6: 00.24 FPLTemplate: FPLTemplateLoad
 7: 00.24 FPLTemplate: FPLTemplateDefaults
 8: 00.24 FPLTemplate: FPLTemplatePageList
 9: 00.24 MakePageList pre
10: 00.24 PageListSources begin
11: 00.24 PageStore::ls begin wiki.d/{$FullName}
12: 00.25 PageStore::ls merge wiki.d/{$FullName}
13: 00.25 PageStore::ls end wiki.d/{$FullName}
14: 00.25 PageStore::ls begin $FarmD/wikilib.d/{$FullName}
15: 00.25 PageStore::ls merge $FarmD/wikilib.d/{$FullName}
16: 00.25 PageStore::ls end $FarmD/wikilib.d/{$FullName}
17: 00.25 PageListSources end count=22
18: 00.25 PageListSort pre ret=4 order=name
19: 00.25 MakePageList items count=22, filters=PageListTermsTargets
20: 00.26 MakePageList post count=21, readc=22
21: 00.26 PageListSort begin
22: 00.26 PageListSort sort
23: 00.26 PageListSort end
24: 00.26 MakePageList end
25: 00.26 FPLTemplate: FPLTemplatePmWikiOrg
26: 00.26 MarkupToHTML begin
27: 00.26 MarkupToHTML end
28: 00.26 FPLTemplate: FPLTemplateSliceList
29: 00.26 FPLTemplate: FPLTemplateFormat
30: 00.27 MarkupToHTML begin
31: 00.28 MarkupToHTML end
32: 00.28 FPLTemplate: FPLTemplatePmWikiOrgPostFormat
33: 00.28 FPLTemplate: Chain end
34: 00.28 MarkupToHTML end
35: 00.28 MarkupToHTML begin
36: 00.30 MarkupToHTML end
37: 00.30 MarkupToHTML begin
38: 00.30 MarkupToHTML end
39: 00.30 now