Get IP address of submitter I'm actually testing a website with Drupal 7.

I am searching a way to get the visitors' IP, when they submit a new node; the users can also be not logged-in, as anonymous users are allowed to submit new content.

I can't find a module to do that, and I don't know how to use hooks or PHP to achieve this.

What should I do?
I haven't found a module which does this yet.  You can do these steps:


Create a text field named ip_address
Manage display: make the field hidden
Use Display Suite or a custom hook (or even CSS) to hide the field when filling out the form
Create a Rule on event "Before saving content"
Set a condition of content type: your content type
Set a condition of Data comparison: [node:is-new], Data value: True (check the checkbox)
Set an action of Set a data value, and set the field to be:


PHP Code

&lt;?php
  print ip_address();
?&gt;


That should do it.

You could also accomplish this by creating a module and using some hooks