Hey everyone, I've spent an hour trying to figure this out on my own and have had no luck. I'd appreciate a nudge in the right direction.

Thanks!

Comments

kenuck’s picture

I think this is what you're looking for: http://api.drupal.org/api/function/hook_comment/5

in your hook function you'll just need to check and make sure user is not logged in.
to get the ip address, try $_SERVER['REMOTE_ADDR']

cheers
-----------------------------------------
http://www.netrift.com - Custom modules
http://ulisting.netriftsolutions.com - Drupal Real Estate Module for Drupal 6
http://drupal.org/project/friend - Social Neworking for Drupal 6

yuriy.babenko’s picture

I usually use this:

function get_ip()
{
	//check for proxy, return real ip
	return ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
}

---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials

---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com

sub_ubi’s picture

So just to make sure, this isn't something that Watchdog handles out of the box?

yuriy.babenko’s picture

I don't know - never looked into this. Take a look at the table and find out :).

---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials

---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com

knaa’s picture

Watchdog does not log general user access. You need to enable the Statistics module under Core-Optional. After that, go to Administer->Logs->Access log settings, and enable "access log."

After going through those steps, you should be able to view a few different logs which show anonymous IPs. However, you still have to look through them to find the anonymous commenter in question. At least, this is how I would track down an anonymous commenter. Hope this helps!

sub_ubi’s picture

Thanks knaa, that worked perfectly

Rhino’s picture

Where do you do this? In comments.module... In the theme?