-
AuthorPosts
-
April 25, 2017 at 9:29 pm #783113
Is there any function we can add to get the IP address of the sender in contact form?
April 25, 2017 at 11:29 pm #783174Hey amrod1!
Thank you for contacting us.
We do not have that option, as our contact form is simple and we keep it as light as possible.Feel free to let us know if there is anything else we can do for you
Regards,
BasilisApril 26, 2017 at 4:36 am #783217I know there is no option for that, I am asking if somebody knows how to add a function to achieve it.
It shouldn’t be rocket science to append a IP address to the message.April 26, 2017 at 6:08 am #783242Hi,
Try to use this plugin: https://wordpress.org/plugins/contact-form-7/ then use this tag to get the sender’s ip address:
[_remote_ip]
You can refer here for more information on the special mail tags: https://contactform7.com/special-mail-tags/
Hope this helps :)Best regards,
NikkoApril 26, 2017 at 3:52 pm #783562Thank you but I dont want to use contactform7.
Any solutions?April 26, 2017 at 11:21 pm #783727I edited framework/php/class-form-generator.php
added the following code:$client_ip = $_SERVER['REMOTE_ADDR']; $message .= 'Client IP: '.$client_ip.'<br />';
Is there a safer way to do this like adding a function to child???
Update will destroy this edit…April 29, 2017 at 3:22 pm #784979Hi amrod1,
You could write a function for one of the filters in that class, like “avf_form_message” for example, depending where you made your change.
If you need further assistance please let us know.
Best regards,
VictoriaMay 5, 2017 at 1:32 am #788160Can you please give an example in code?
I added to line # 891 in function sendMay 5, 2017 at 6:34 am #788203Hi,
You can use this code as an example:
function add_custom_code(){ ?> PASTE YOUR CODE HERE
Best regards,
John TorvikNovember 19, 2017 at 11:58 pm #878904So is there any way to capture users IP address and time stamp with the contact form?
November 20, 2017 at 5:26 am #878966Hi,
Can you try adding this php code at the bottom of functions.php:
add_filter('avf_form_message', 'avf_form_message_mod', 10, 3); function avf_form_message_mod($message, $new_post, $form_params) { $client_ip = $_SERVER['REMOTE_ADDR']; $message = $message . '\nClient IP: '.$client_ip; return $message; }
Best regards,
NikkoNovember 20, 2017 at 6:38 am #878975It worked! Thank you. Is there a way to make a timestamp of when they submitted the form as well? And is there a way to make drop down menus correspond to each other? Depending on which selection you make first the next drop down changes, and so on?
- This reply was modified 7 years, 1 month ago by jaredj89.
November 20, 2017 at 6:29 pm #879269Hi,
You’re welcome, you can add this for the timestamp:
add_filter('avf_form_message', 'avf_form_message_mod', 10, 3); function avf_form_message_mod($message, $new_post, $form_params) { $client_ip = $_SERVER['REMOTE_ADDR']; $the_date .= date("F j, Y, g:i a"); $message = $message . '\nClient IP: '.$client_ip.'\nDate & Time: '.$the_date; return $message; }
As for the dropdown, I think it’s a bit complicated and would require some time to do it and is outside the scope of our support, you might want to check 3rd party contact form plugins, some might offer what you need. :)
Best regards,
Nikko -
AuthorPosts
- You must be logged in to reply to this topic.