Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#373 2022-10-31 05:40:21

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: com_connect - form and contact mailer

peterj wrote #334052:

I had similar issues recently due to increased outgoing spam filtering by host, ended up fixing by adding the from attribute to the com_connect tag. By default I think it tries to send from the address of the person filling in the form, which may not authenticate. For best authentication the “from” and the “to” email addresses should be on the same domain as the website.

Thanks for the tip. Good to know.

All my problems vanished as soon as I had fully migrated the duits.co domain (used for the email address) to the same hosting service as dejima-tokyo.com (the domain used for the website).


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#374 2022-11-15 14:25:04

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: com_connect - form and contact mailer

We’ve recently encountered a problem using to_form and the most recent com_connect on PHP 8+.

Using this tag:

<txp:com_connect_select label="Department" options="{Please choose},Support,Sales" />

and the following to_form (as per the docs):

<txp:php>
    global $com_connect_form;
    switch($com_connect_form['Department'])
    {
        case 'Support':
            echo 'crew@example.com';
            break;
        case 'Sales':
            echo 'showmethemoney@example.com';
            break;
        default:
            echo 'someone@example.com';
    }
</txp:php>

the switch appears never to match, always reverting to the “default” option.

On dumping $com_connect_form in the thanks_form, it appears that $com_connect_form['Department'] is stored as an array and the switch statement cannot match it against a string. After changing the second line to:

switch($com_connect_form['Department'][0])

the to_form works again.

Have I done something wrong in the form? Or has something perhaps changed in the way it is processed in PHP8? Or does the output of com_connect_select() need to be into a string if it’s not a multiple select form?


TXP Builders – finely-crafted code, design and txp

Offline

#375 2022-11-15 15:26:04

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

Re: com_connect - form and contact mailer

Not you. The latest version needs the [0] to work. I thought I’d updated the docs but maybe I only updated the 4.9.0 branch by mistake, or missed one of the examples. Sorry for the hassle.


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

Online

#376 2022-11-15 15:44:54

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: com_connect - form and contact mailer

Ah, thanks for the confirmation. No matter about the omission: good to know that my amateur code pokings were in the right direction.

BTW: this was with v 4.7.0 with my minor self-closing tags modifications.

EDIT: I submitted a PR with the update to the docs


TXP Builders – finely-crafted code, design and txp

Offline

#377 2023-01-10 12:45:39

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: com_connect - form and contact mailer

Hello,

recently I recognized, that com_connect_serverinfo stopped working in v4.7.0 with textpattern 4.8.8.

By setting something like:

<txp:com_connect_serverinfo name="REMOTE_ADDR" label="IP Nummer" />
<txp:com_connect_serverinfo name="HTTP_USER_AGENT" label="Browser" />
<txp:com_connect_serverinfo name="REQUEST_URI" label="URI" />

I get only the labels, without any data.

IP Nummer: 

Browser: 

URI: 

I tested it with php 8.0.27 and php 8.1.14. So it is probably not linked to php 8.1. I also don’t see any warnings or errors in log files.

Offline

#378 2023-01-10 14:11:08

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

Re: com_connect - form and contact mailer

Thanks for the report. I’ll run some tests later and try to find out what’s going on.


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

Online

#379 2023-01-10 17:24:46

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

Re: com_connect - form and contact mailer

whocarez wrote #334485:

Hello,

recently I recognized, that com_connect_serverinfo stopped working in v4.7.0 with textpattern 4.8.8.

By setting something like:

<txp:com_connect_serverinfo name="REMOTE_ADDR" label="IP Nummer" />...

I get only the labels, without any data.

IP Nummer:...

I tested it with php 8.0.27 and php 8.1.14. So it is probably not linked to php 8.1. I also don’t see any warnings or errors in log files.

Just to say that I have them working on php 8.0.12.


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

Offline

#380 2023-01-10 18:22:46

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

Re: com_connect - form and contact mailer

I do suspect this is a server issue, but I can’t say for sure until I run a few tests. It may depend if the server is configured to pass that info.

Whocarez: you might get a clue from the browser inspector’s network pane. When you make requests to the server for the site, does it pass any of the server vars you’re interested in?


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

Online

#381 2023-01-11 00:02:51

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: com_connect - form and contact mailer

Bloke wrote #334489:

I do suspect this is a server issue,

Probably yes, I have the txp:com_connect_serverinfo name="REMOTE_ADDR" one working fine on different servers / hosts and different versions of PHP (8.0 and 8.1).

info.php may also tell that (search for $_SERVER['REMOTE_ADDR']).


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#382 2023-01-11 18:42:05

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: com_connect - form and contact mailer

Hm, I rechecked that and with v4.6.0 it is working, but with v4.7.0 not.
phpinfo() gives normal server variables, like that

$_SERVER['HTTP_USER_AGENT']	Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0

I fetched the plugin from github.

Offline

#383 2023-01-11 18:45:31

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

Re: com_connect - form and contact mailer

Okay, so it’s likely to be the plugin at fault then. Thanks for checking. I’ll have to do some debugging.


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

Online

#384 2023-01-16 18:18:29

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: com_connect - form and contact mailer

Had today some time for more tests.
So, if I comment out in function com_connect_serverinfo

$name = sanitizeForUrl($name);

then it works.

sanitizeForUrl makes everything lowercase, as far as I understand it. So REMOTE_ADDR gets remote_addr. And because the server variables are case sensitive, they cannot be found.

Offline

Board footer

Powered by FluxBB