Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
zem_contact_reborn v4.5.0.0: contact mail form processing
IMPORTANT: This plugin is now deprecated and has been rebranded as com_connect.
Original thread retained for historical value below.
———————————————
Following on from the rock-solid v4.0.3.20 this is the next iteration of the plugin. If you don’t care why you need it you can grab a compiled copy from GitHub.
Installation
- Backup your existing plugin / site if using a prior version of the plugin.
- Disable zem_contact_lang if it’s installed.
- Install and activate the new zem_contact_reborn plugin.
French and English textpacks are distributed with the plugin by default. If anybody has any translations, please send the textpacks to me for inclusion in the final release. I’ll also host them separately on my site or maybe with the GitHub release if I can add to it (not sure if that’s possible).
What’s new
Documentation is pretty fully featured so I’d advise you start there if in any doubt. But for the most part, it’s a drop-in replacement for v4.0.3.20 that has been significantly refactored behind the scenes to allow other plugins to have more control over the mail process. From the tag side, you have a whole raft of HTML 5 input attributes available. These include:
- accesskey
- autocomplete
- autofocus
- class
- dir
- disabled
- form (auto-filled in on your behalf by default)
- hidden
- id
- lang
- list
- max
- min
- pattern
- placeholder
- readonly
- spellcheck
- step
- style
- tabindex
- title
- translate
- type (for
<txp:zem_contact_text>
only) - wrap (for
<txp:zem_contact_textarea>
only)
These attributes are not universal for every type of input widget, they are only applied where it makes sense and if your Textpattern installation has been set to output HTML 5. If you’re in any doubt what’s accepted where, consult the W3C spec as this follows it as closely as I can, considering it’s a moving target.
In addition, the <txp:zem_contact>
tag accepts these additional attributes:
body_form
so you can define body content in a Form.expire
so you can set how long, in seconds, the form expires (default: 600)required
which allows you to globally toggle on or off therequired
attribute for all contained ZCR tags. By default they’re all set to be ‘required’ but there are times you may want to have a form where most of the fields are optional. In the old plugin you had to explicitly turn off therequired
attribute for every tag, but now you can just turn it off once in the main ZCR container tag and then switch it on only for the tags you need. Or vice versa.
There’s also a new <txp:zem_contact_option>
tag so you can define custom select lists inside your <txp:zem_contact_select>
, and a conditional tag <txp:zem_contact_if>
which accepts name/label/value attributes to compare the given attribute name or label against the given value. Haven’t fully tested that yet, reports or improvements welcome.
For programmers wanting to try out the new zemcontact.deliver
callback, the code is fairly well documented. Lots of fun can be had in plugins by either:
- altering the
$payload
passed to your plugin, such as adding Multi-part MIME headers for HTML emails (thezemcontact.render
callback works in tandem with this for making alterations to the front-end form). - returning
zemcontact.send
(or no return value) to allow Zem Contact Reborn to continue mailing the content. - returning
zemcontact.skip
to skip zem_contact’s mailing (i.e. your code handles mailing) and return ‘success’ message. - returning
zemcontact.fail
to skip zem_contact’s mailing and return ‘fail’ message. - exit from inside your plugin after doing your code, but note this will not do any ZCR redirect that may be in place.
You can also target the first or second (copysender) send process by hooking into the callback’s step using send
or copysender
respectively. Or omit it to have your plugin called twice.
The idea behind this release is that it’s more of a platform for communication than just for plain mailing. The callbacks allow all manner of additional plugin to spring up. Examples:
- HTML email sending.
- Anti-spam modules.
- Captcha (yuk!) modules.
- Third party mailer integration (e.g. MailChimp).
- Send attachments / file upload facility.
Out of the box, it will still send plain old email. But the possibilities for using it as a springboard for other purposes are greatly enhanced, so I’m looking forward to what you can dream up. I’ve already written some companion modules for it which will probably get released at some point (MailChimp integration and file attachments). Watch this space.
In the meantime, have fun and please report anything good, bad or indifferent here. Happy contacting.
Last edited by Bloke (2017-07-18 23:38:47)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: zem_contact_reborn v4.5.0.0: contact mail form processing
@Bloke … this is great, super, fantastic … and with MailChimp support … :))))
Offline
Re: zem_contact_reborn v4.5.0.0: contact mail form processing
Brilliant. Thank you!
Will existing plugins that hooked into zcr need changing for the callbacks, or is that backwards-compatible/same-as-before?
TXP Builders – finely-crafted code, design and txp
Offline
Re: zem_contact_reborn v4.5.0.0: contact mail form processing
Am I doing something wrong ? I get a bunch of tag errors
in debugging mode – TXP 4.6dev:
Tag error: <txp:zem_contact label="foo" to="recipient@example.com"> -> Textpattern Notice: unregistered_tag while parsing form pw_contact on page default
the form pw_contact
is just a typical form of the misc
type called by <txp:output_form form="pw_contact" />
That said everything seems to work fine so far, the form is displayed etc. Not sure if the mail actually is send, can’t test that on my local dev install.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: zem_contact_reborn v4.5.0.0: contact mail form processing
jakob wrote #297769:
Will existing plugins that hooked into zcr need changing for the callbacks.
Not as far as I’m aware. The new callbacks are additions only.
I think pap_contact_cleaner still works as-is for example. What other plugins are there I need to test?
phiw13 wrote #297771:
Textpattern Notice: unregistered_tag
D’oh. Helps if I register the tags. I have my dev site in Testing mode because that warning was winding me up in other plugins and I forgot to switch to debugging before release. I’ll add an issue and get it resolved, thanks.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Offline
Re: zem_contact_reborn v4.5.0.0: contact mail form processing
Hi Stef
Great it was time to improve our old zem_contact_reborn!
Have you added a required ad on input field like that also when it required, becauseit s used by foundation form validation:
<input name="myinput" required />
Offline
Re: zem_contact_reborn v4.5.0.0: contact mail form processing
Bloke wrote #297772:
D’oh. Helps if I register the tags.
Oh good, an oversight… Fixed I see (I hacked my local installed copy continue playing around without the noise now). Thanks.
@Dragondz Yes it is there, configurable.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: zem_contact_reborn v4.5.0.0: contact mail form processing
@phiw13
Thanks for the clarification.
Offline
Re: zem_contact_reborn v4.5.0.0: contact mail form processing
Thanks Stef: great stuff. I appreciate the extensive help text :)
Continuing from this thread:
I upgraded my form to the new plugin and did some more testing.
- New user emails get received, whether sent to external or domain-native email addresses.
- I still get the Sorry, unable to send email. failure message whether I have the ‘SMTP envelope sender address’ field filled with a domain-native email address or left empty.
- I tried disabling fields to see where the problem lay, and discovered that the form works every time, as long as I exclude the <txp:zem_contact_email /> field.
I’m stuck :(
What should I try next? Thanks all…
Offline
Re: zem_contact_reborn v4.5.0.0: contact mail form processing
Hi Stef ;)
W3C validator error found: Bad value for autofocus="1"
<input class="zemText zemRequired" id="q614cffa523202658a898e34a5d94d05e" name="q614cffa523202658a898e34a5d94d05e" type="text" maxlength="100" autocomplete="on" form="zcr55c6e8afe672973fae7b31f0ae32a2a0" required="required" autofocus="1" dir="ltr" lang="en-gb" title=" Your First & Last Names, required " />
It seems that autofocus
allows autofocus="autofocus"
or single word autofocus
(same use as the required
attribute).
Last edited by Pat64 (2016-02-11 14:05:56)
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: zem_contact_reborn v4.5.0.0: contact mail form processing
Pat64 wrote #297828:
W3C validator error found: Bad value for
autofocus="1"
Good catch, thanks. The new boolean attributes probably shouldn’t have any value at all if you are using HTML 5. Not sure how best to implement that, but I’ll see what I can do.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline