Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #783113

    Is there any function we can add to get the IP address of the sender in contact form?

    #783174

    Hey 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,
    Basilis

    #783217

    I 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.

    #783242

    Hi,

    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,
    Nikko

    #783562

    Thank you but I dont want to use contactform7.
    Any solutions?

    #783727

    I 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…

    #784979

    Hi 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,
    Victoria

    #788160

    Can you please give an example in code?
    I added to line # 891 in function send

    #788203

    Hi,

    You can use this code as an example:

    function add_custom_code(){
    ?>
    
    PASTE YOUR CODE HERE 
    
    
    

    Best regards,
    John Torvik

    #878904

    So is there any way to capture users IP address and time stamp with the contact form?

    #878966

    Hi,

    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,
    Nikko

    #878975

    It 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.
    #879269

    Hi,

    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

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.