You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
How can we include the senders I.P. address in the contact form message sent to the site owner?
Offline
Knock Knock
Offline
I've tried several different ways and always get after trying to send:
There was an error encountered when trying to send your email message. Perhaps an invalid email address was entered. Please try again.
Offline
it should be
IP Address: <?php print $_SERVER['REMOTE_ADDR']; ?>
Offline
The extra bracket was the culprit. Thank you! It works now.
Offline
I have the same question for a different instance. Wondering how to include this in a dynamic form like a customer feedback form.
Last edited by timberguy (11-01-2017 13:00:07)
Offline
Doing this for a dynamic for requires editing the {private}/apps/cms/CMS_Dynforn/CMS_Dynform.php class. There you will find the function dynform_proc(). In that function, you will see the submitted values being added to the mail in the block commented with:
// +-- // | Check out our required fields and build onto our message. // +--
Right after that code block (after the surrounding foreach closes) add:
$plaintext .= 'IP Address:' . $eol . $_SERVER['REMOTE_ADDR'] . $eol . $eol; if ($sendxhtml) { $xhtmltext .= '<p><strong>IP Address</strong></p>' . $eol; $xhtmltext .= '<p>' . $this->CORE_Display->xhtml_encode($_SERVER['REMOTE_ADDR']) . '</p>' . $eol . $eol; } // End of if statement.
Offline
Got it Nick! Thank you!
Offline