PmForm

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. Configure PmForm
    • For PmWiki 2.3.37 or more recent:
      1. Modify your local/config.php or other local customization file, enabling PmForm
        $EnablePmForm = 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");
    • 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");
  2. 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';
  3. Create wiki page called Site.LocalTemplates if it doesn't exist already
  4. 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)
  5. 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:

  • Forms   Markup and Standard input controls to embed input forms into wiki pages
  • Basic Email Form with Honeypot and Captcha   a walkthrough creating a basic email form with honeypot & captcha (by Xes)
  • Comments   Add comments to current page, or a comment page
  • DataForms   Using PmForm to save data on wiki pages
  • GDPR Comments   Add comments to current page, or a comment page, GDPR compliant
  • GDPR MailForm   forms for sending electronic mail, GDPR compliant
  • HoneyPot   Implementing "honeypots" for spam-control in forms
  • MailForm   Using PmForm to send electronic mail from a form in a page

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 config end
  1: 00.01 MarkupToHTML begin
  2: 00.02 ReadApprovedUrls SiteAdmin.ApprovedUrls begin
  3: 00.03 ReadApprovedUrls SiteAdmin.ApprovedUrls end
  4: 00.03 FPLTemplate: Chain begin
  5: 00.03 FPLTemplate: FPLTemplateLoad
  6: 00.03 FPLTemplate: FPLTemplateDefaults
  7: 00.03 FPLTemplate: FPLTemplatePageList
  8: 00.03 MakePageList pre
  9: 00.03 PageListSources begin
 10: 00.03 PageStore::ls begin wiki.d/{$FullName}
 11: 00.04 PageStore::ls merge wiki.d/{$FullName}
 12: 00.04 PageStore::ls end wiki.d/{$FullName}
 13: 00.04 PageStore::ls begin $FarmD/wikilib.d/{$FullName}
 14: 00.04 PageStore::ls merge $FarmD/wikilib.d/{$FullName}
 15: 00.04 PageStore::ls end $FarmD/wikilib.d/{$FullName}
 16: 00.04 PageListSources end count=1
 17: 00.04 PageListSort pre ret=4 order=name
 18: 00.04 MakePageList items count=1, filters=
 19: 00.04 MakePageList post count=1, readc=0
 20: 00.04 PageListSort begin
 21: 00.04 PageListSort sort
 22: 00.04 PageListSort end
 23: 00.04 MakePageList end
 24: 00.04 FPLTemplate: FPLTemplatePmWikiOrg
 25: 00.04 MarkupToHTML begin
 26: 00.04 MarkupToHTML end
 27: 00.04 FPLTemplate: FPLTemplateSliceList
 28: 00.04 FPLTemplate: FPLTemplateFormat
 29: 00.04 MarkupToHTML begin
 30: 00.04 MarkupToHTML end
 31: 00.04 FPLTemplate: FPLTemplatePmWikiOrgPostFormat
 32: 00.04 FPLTemplate: Chain end
 33: 00.04 FPLTemplate: Chain begin
 34: 00.04 FPLTemplate: FPLTemplateLoad
 35: 00.05 FPLTemplate: FPLTemplateDefaults
 36: 00.05 FPLTemplate: FPLTemplatePageList
 37: 00.05 MakePageList pre
 38: 00.05 PageListSources begin
 39: 00.05 PageStore::ls begin wiki.d/{$FullName}
 40: 00.05 PageStore::ls merge wiki.d/{$FullName}
 41: 00.05 PageStore::ls end wiki.d/{$FullName}
 42: 00.05 PageStore::ls begin $FarmD/wikilib.d/{$FullName}
 43: 00.05 PageStore::ls merge $FarmD/wikilib.d/{$FullName}
 44: 00.05 PageStore::ls end $FarmD/wikilib.d/{$FullName}
 45: 00.05 PageListSources end count=7
 46: 00.05 PageListSort pre ret=4 order=name
 47: 00.05 MakePageList items count=7, filters=
 48: 00.05 MakePageList post count=7, readc=0
 49: 00.05 PageListSort begin
 50: 00.05 PageListSort sort
 51: 00.05 PageListSort end
 52: 00.05 MakePageList end
 53: 00.05 FPLTemplate: FPLTemplatePmWikiOrg
 54: 00.05 MarkupToHTML begin
 55: 00.05 MarkupToHTML end
 56: 00.05 FPLTemplate: FPLTemplateSliceList
 57: 00.05 FPLTemplate: FPLTemplateFormat
 58: 00.05 MarkupToHTML begin
 59: 00.06 MarkupToHTML end
 60: 00.06 FPLTemplate: FPLTemplatePmWikiOrgPostFormat
 61: 00.06 FPLTemplate: Chain end
 62: 00.06 FPLTemplate: Chain begin
 63: 00.06 FPLTemplate: FPLTemplateLoad
 64: 00.06 FPLTemplate: FPLTemplateDefaults
 65: 00.06 FPLTemplate: FPLTemplatePageList
 66: 00.06 MakePageList pre
 67: 00.06 PageListSources begin
 68: 00.06 PageStore::ls begin wiki.d/{$FullName}
 69: 00.06 PageStore::ls merge wiki.d/{$FullName}
 70: 00.06 PageStore::ls end wiki.d/{$FullName}
 71: 00.06 PageStore::ls begin $FarmD/wikilib.d/{$FullName}
 72: 00.06 PageStore::ls merge $FarmD/wikilib.d/{$FullName}
 73: 00.06 PageStore::ls end $FarmD/wikilib.d/{$FullName}
 74: 00.06 PageListSources end count=3
 75: 00.06 PageListSort pre ret=4 order=name
 76: 00.06 MakePageList items count=3, filters=
 77: 00.06 MakePageList post count=3, readc=0
 78: 00.06 PageListSort begin
 79: 00.06 PageListSort sort
 80: 00.06 PageListSort end
 81: 00.06 MakePageList end
 82: 00.06 FPLTemplate: FPLTemplatePmWikiOrg
 83: 00.06 MarkupToHTML begin
 84: 00.06 MarkupToHTML end
 85: 00.06 FPLTemplate: FPLTemplateSliceList
 86: 00.06 FPLTemplate: FPLTemplateFormat
 87: 00.06 MarkupToHTML begin
 88: 00.06 MarkupToHTML end
 89: 00.06 FPLTemplate: FPLTemplatePmWikiOrgPostFormat
 90: 00.06 FPLTemplate: Chain end
 91: 00.06 FPLTemplate: Chain begin
 92: 00.06 FPLTemplate: FPLTemplateLoad
 93: 00.06 FPLTemplate: FPLTemplateDefaults
 94: 00.06 FPLTemplate: FPLTemplatePageList
 95: 00.06 MakePageList pre
 96: 00.06 PageListSources begin
 97: 00.06 PageStore::ls begin wiki.d/{$FullName}
 98: 00.07 PageStore::ls merge wiki.d/{$FullName}
 99: 00.07 PageStore::ls end wiki.d/{$FullName}
100: 00.07 PageStore::ls begin $FarmD/wikilib.d/{$FullName}
101: 00.07 PageStore::ls merge $FarmD/wikilib.d/{$FullName}
102: 00.07 PageStore::ls end $FarmD/wikilib.d/{$FullName}
103: 00.07 PageListSources end count=22
104: 00.07 PageListSort pre ret=4 order=name
105: 00.07 MakePageList items count=22, filters=PageListTermsTargets
106: 00.07 MakePageList post count=21, readc=22
107: 00.07 PageListSort begin
108: 00.07 PageListSort sort
109: 00.07 PageListSort end
110: 00.07 MakePageList end
111: 00.07 FPLTemplate: FPLTemplatePmWikiOrg
112: 00.07 MarkupToHTML begin
113: 00.07 MarkupToHTML end
114: 00.07 FPLTemplate: FPLTemplateSliceList
115: 00.07 FPLTemplate: FPLTemplateFormat
116: 00.07 MarkupToHTML begin
117: 00.07 MarkupToHTML end
118: 00.07 FPLTemplate: FPLTemplatePmWikiOrgPostFormat
119: 00.07 FPLTemplate: Chain end
120: 00.07 MarkupToHTML end
121: 00.07 MarkupToHTML begin
122: 00.08 MarkupToHTML end
123: 00.08 MarkupToHTML begin
124: 00.08 MarkupToHTML end
125: 00.08 now