Postmaster [PM] utilizes the Zem_Contact_Reborn [ZCR] API to allow the use of that robust plugin’s capabilities. You set up a ZCR form as you would any other [see the ZCR documentation for more on this]; the only difference between a regular contact form and a PM form will be the name values you assign to particular fields in the form.
Here’s an example subscription form:
<txp:zem_contact to="youremail@yourwebsite.com" >
<txp:zem_contact_text name="zemSubscriberName" label="Your Name:" />
<txp:zem_contact_email name="zemSubscriberEmail" label="Your Email:" />
<txp:zem_contact_select list="default,test" selected="default" name="zemSubscriberLists" label="Your List:" />
<txp:zem_contact_text name="zemSubscriberCustom1" label="Your Favorite Color:" />
<txp:zem_contact_checkbox label="This is not Spam. " />
<txp:zem_contact_submit />
</txp:zem_contact>
This form will:
- Send a subscription notice (ie, an email that so-and-so subscribed) to whatever email address you enter
- Display fields for Subscriber Name, Email, and Favorite Color, a dropdown choice for what list to subscribe to, and a checkbox that is required as an anti-spam method
The subscription form is truly customizable. Styling is carefully worked out by the folks over at ZCR — check out this page for documentation.
I suggest reading the ZCR documentation thoroughly, and taking advantage of all the tag attributes you can.
Proper “name” values are important — the possibilities are:
name="zemSubscriberName"name="zemSubscriberEmail"name="zemSubscriberLists"name="zemSubscriberCustom1"name="zemSubscriberCustom2"name="zemSubscriberCustom3"name="zemSubscriberCustom4"name="zemSubscriberCustom5"name="zemSubscriberCustom6"name="zemSubscriberCustom7"name="zemSubscriberCustom8"name="zemSubscriberCustom9"name="zemSubscriberCustom10"name="zemUnSubscribe"name="zemDoSubscribe"
What is going on here?
Postmaster [PM] is called each time any ZCR form is submitted.
PM runs a few checks:
- First, is it a PM form at all? PM checks if there is a “name=zemSubscriberEmail” value sent. If one of the values submitted has “name=zemSubscriberEmail,” then PM safely assumes this form is meant to be submitted to PM.
- If it is a PM form, is one of the values “name=zemDoSubscribe”? In other words, has the admin created a form that can be used either as a straight-up contact form or a contact / subscription form?
- If one of the values is “name=zemDoSubscribe,” is the value set to “No”?
- If it’s set to “No,” then PM returns without doing anything. If it is set, but it isn’t set to “No,” then it continues normally.
- Then PM checks if “zemUnSubscribe” is set. If it is, it removes the submitted email address from the database instead of adding it.
- Finally, if the submission passes all of these checks, PM enters the values into the database as a new subscriber.