Anonymizing IP addresses and simplifying comment moderation

Discussion corner for Developers of Serendipity.
Post Reply
Manko10
Regular
Posts: 50
Joined: Sun Dec 26, 2010 4:58 pm

Anonymizing IP addresses and simplifying comment moderation

Post by Manko10 »

Hi there,

not sure were to post feature requests. If you like it better in the bugs forum, please move this thread.

There should be an option to anonymize IP adresses for comments as well as for any logs (such as the spam log). This option should let you choose

a) to save the full IP without any anonymization
b) to x out the last one, two or three octets of the IP address
c) not to save the IP at all (or rather replace it with 127.0.0.1)

To ensure also third-party plugins obey these rules, this could be implemented by modifying $_SERVER['REMOTE_ADDR'] right after loading the s9y core components (i.e. in a very early stage).
The anonymized IP address should of course also be use for Akismet or Typepad checking. I know, there is already an option to anonymize this, but since I haven't studied the code, I'm not completely sure what this does. Anyway, this option will be obsolete if the feature requested above is implemented. The Akismet/Typepad plugin then just uses the processed IP (which might of course be the local host).

Another feature, also related to comments and spam logs, but not to IP addresses is to simplify comment approval. A great feature would be to (optionally) auto-approve comments from people who have been approved before. That means when I approve a comment from John Doe with the email address johndoe@example.com, John is automatically added to a white list. The next time John comments, his comment will be approved automatically.
As the admin of the site I can of course also remove him from the white list at any time and I can also block him permanently (add him to a blacklist). I can also choose not to auto-add him to to the white list when approving comments.
This feature might also be extended so that I can choose to except people on the white list from the spam filter alltogether (not just the moderation rules).
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Anonymizing IP addresses and simplifying comment moderat

Post by garvinhicking »

Hi!

As a shortcircuit, you could easily place a PHP snippet inside your serendipity_config_local.inc.php that does the replacement of $_SERVER['REMOTE_ADDR']?

The other idea of auto-approving sounds good, I even think we have code of email confirmation already in there that "accepts" an email adress by email verification...maybe that could act as a starting point...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Manko10
Regular
Posts: 50
Joined: Sun Dec 26, 2010 4:58 pm

Re: Anonymizing IP addresses and simplifying comment moderat

Post by Manko10 »

Yeah, doing that in our local config file would be a workaround though an option for that in the settings would be better.

For the comments thing: I think that could indeed be a starting point, but just for developing this feature. Approving comments by email verification is not very comfortable for the user.

EDIT:
If other people need that as well: what I put in my local config is this:

Code: Select all

// Anonymize IP addresses:
	$_SERVER['REMOTE_ADDR'] = preg_replace('#(?:\.\d+){2}$#', '.0.0', $_SERVER['REMOTE_ADDR']);
EDIT2: To anonymize existing MySQL comments in the database run the following query:

Code: Select all

UPDATE `s9y_comments` SET `ip` = CONCAT(SUBSTRING_INDEX(`ip`, '.', 2), '.0.0');
Of course, do a backup first!
Post Reply