Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#205 2017-06-23 14:07:26

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,093
Website GitHub Mastodon Twitter

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

Is there a way to have a pull down menu with different recipients using the zcr?

At the moment all I see is

<txp:zem_contact to="recipient@example.com">

… unless of course I am missing something!


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#206 2017-06-23 14:22:51

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,310

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

Bloke wrote #306064:

[…]if there’s anything in the $zem_contact_error variable. […]

So I put <txp:variable name="zem_contact_error" /> for testing on the page, inside the body class, to see what’s in there on an error, but there’s nothing new there. Am I doing it wrong?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#207 2017-06-23 14:27:21

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,310

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

Yiannis, the section “User selectable recipient, without showing email address” from the plugin help might be what you’re after.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#208 2017-06-23 15:05:33

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,093
Website GitHub Mastodon Twitter

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

Hi Uli,

Thanks so much! that was it!


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#209 2017-06-23 15:42:22

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,310

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

uli wrote #306066:

So I put <txp:variable name="zem_contact_error" /> for testing on the page

OK, I see that was certainly not what you meant, Stef, but tracing errors in the console window didn’t give a hint either …


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#210 2017-06-23 15:56:12

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

uli wrote #306066:

So I put <txp:variable name="zem_contact_error" /> for testing on the page

Ah, no. You’ll only be able to get to the variable from PHP. Try making a new public-side plugin from Plugin Composer and enable it:

register_callback('uli_zcr_bodyclass', 'zemcontact.render');

function uli_zcr_bodyclass($evt, $stp, $data, $atts)
{
    global $zem_contact_error;
    dmp($zem_contact_error); // Just to see what it contains

    if ($zem_contact_error) {
        echo script_js(<<<EOJS
jQuery(function() {
    jQuery('body').addClass('zemerror');
});
EOJS;
        );
    }
}

Untested, but something like that might work.


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

#211 2017-06-23 16:14:10

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,093
Website GitHub Mastodon Twitter

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

And here’s another question

Is there a way to have one contact form which could be embedded in various domains (php pages) using the rah_external plugin?

ie using

<?php
echo file_get_contents('http://www.my_txp_install.txp/?rah_external_output=my_contact_form');
?>

> Edit: I did not manage to send an email using the above yet!

?

Last edited by colak (2017-06-23 16:31:39)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#212 2017-06-23 17:18:44

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,310

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

Ah, setting up a plugin is beyond my scope. The more I have to thank you for it!

We’re coming closer: the script is inserted, but twice. Still no new class in the body tag, though. I’m scratching my head.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#213 2017-06-26 05:48:25

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,093
Website GitHub Mastodon Twitter

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

This is possibly a new question. In the past few months we have been receiving 2-3 spam emails/week/zcr form I have installed in our sites.

The emails come from various IP addresses so I can not block those. What they all have in common is the sender’s email address whose pattern is: fundingteam+mydomain.tld@businessloansfunded.com.

Is there a way to block them on the plugin/server side?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#214 2017-06-26 09:10:00

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

The plugin can’t block it natively, but you can easily throw together a plugin module for it. Here’s a simple example plugin:

register_callback('zcr_verify', 'zemcontact.submit');

function zcr_verify()
{
    $emailField = trim(ps('Email'));
    $banPatterns = explode("\n", fetch_form('zcr_spam_patterns'));

    $evaluation = &get_zemcontact_evaluator();

    // If the email address matches one of the given patterns, fail.
    foreach ($banPatterns as $pattern) {
        $pat = trim($pattern);

        if ($pat && preg_match($pat, $emailField)) {
            $evaluation -> add_zemcontact_status(1);
        }
    }

    return;
}

It uses a specially-named form called zcr_spam_patterns to hold a list (one per line) of regular expressions that will be matched against the email field. Just add lines like this:

/fundingteam.*?@businessloansfunded.com/
/spammer.*?@example.org/
...

remembering to delimit each line with ‘/’ (unless you’re using that character in your expression itself, then you’d use a different character for the delimiter) and you’re away.

Hope that helps.


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

#215 2017-06-26 12:32:38

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,093
Website GitHub Mastodon Twitter

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

Hi Stef… Thanks so much for your advice. is this how it is done?

# Name: zcr_prevent_spam v0.1 (compressed)
# Type: Public plugin
# Use patterns to prevent spam
# Author: Stef Dawson
# URL: http://stefdawson.com/
# Recommended load order: 5

# .....................................................................
# This is a plugin for Textpattern CMS - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# .....................................................................

H4sIAAAAAAAAA11SwYrbMBC9B/IPg1hiB9LEzjrbRCE9tYXeCqW3gpHlUSxqW0aS0+4u+fdK
sp3NVifz5s3Me8/DaJrSV0MzSlrWIDkamj5R8sJ13mm8YGtz07HG4w5mva2UDqSUkh8WBXxm
f4xqA5RMhLzX0iPbLSWVtR3dbIzjloG65qrZ+OpHSi6ojRy6HylJ1uk0ukTDtezsWNzuKflp
EDpmLerWgFUwyoNJnnPAVRkc7LYHSjSepduqc87qumD8dxx5V26lFM/RCqIXbLhqLeN2bfqi
kTZaHuez+Uz0LfeL4Y0eL+ez1/kM3HvAhsn6q8S6hBNYLZu4M3H0xaPR0k8IrIK13yexJ8C/
Xe20xeRXS1Yg0PIqF0o3gyTvIJ+sDTOmXRdW9yyIOcHijDZ/E52PRaXjt47NBr4JsBVCkAms
LDUaAw1zK9GAahHUQDhLF98tUafK8dfDFCcNGa8gfmeDGXgY6UsY0wgqHThFcSPcFPknBYQK
LBb+t53zICdAq/tAl+/m/p/Ah0/ezn0CxjLbmzidUvfvOnxep/0aba9bR7iOR2Kfu+HM3cGF
Y6FE6RL1iO1GTNTsbO55rrXCuiPHgibDvTZlID+6K0/EPi2KhO8FHnbZU3FIDhnjuyIRuMUs
y8jx+g/udwWUagMAAA==

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#216 2017-06-26 13:11:19

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: zem_contact_reborn v4.5.0.0: contact mail form processing

colak wrote #306083:

is this how it is done?

If the plugin works, yes! Does it do what you want?


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

Board footer

Powered by FluxBB