2

I'm using the Guest Entries plugin and it's all working great, the problem is I'm getting spammed like mad. I've got snaptcha installed which seems to be catching some of it but I could do with an IP log so I can see if it is coming from a certain IP or IP range.

I ideally want the IP logged with the form submission as server access logs are hard to match up.

1 Answer 1

1

You could add a field "IP Address" to your Entry Type and make the form submit the guest's IP (→ getIpAddress() method) via a hidden field.

<input type="hidden" name="fields[ipAddress]" value="{{ craft.request.getIpAddress() }}">

For further improvements you could make your own field type for "IP Address" with a plugin, that adds custom validation (→ block certain IP ranges). You could also hide the field from the CP or make it only readable.

1
  • But if you create a field, then the IP address will become searchable ... (because it is not possible to exclude fields from search).
    – MISC
    Commented Jun 1, 2016 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.