IPs are not removed after 6 hours
-
Hi there,
thank you that you provide this useful little plugin! Unfortunately for me it’s not working. 8 hours after activation there are still all IPs of the existing comments in the database.
I have a crontab running every 10 minutes calling the wp-cron.php
What could be the reason? Do you need further information?
Many thanks in advance
David
-
How many comments do you have?
It could be that you don’t run wp-cron often enough. Can you please install WP Crontrol and have a look at the pending wp-cron tasks?
There are 388 comments in total (16 approved, 372 spam).
I’ve installed WP Crontrol but I can’t find the hook of “Remove Comment IPs” in the list. What’s the hook’s name?
remove_comment_ip_handle
Did you install and enable the plugin and then immediately disable it? That would unschedule all the events.
You can flip the
remove_comment_ips_firstrun
option back to 0 to run it again (there is no UI for this, so you either have to useset_option
or do it directly in the database).Hm,
I installed the plugin – nothing happend after many hours.
I looked for the cron-task in WP control and found 2 tasks:remove_comment_ip_handle
[
11486
]
remove_comment_ip()
2018-06-25 17:32:05 (1 month 4 weeks) Non-repeatingand
remove_comment_ip_handle
[
11487
]
remove_comment_ip()
2018-06-26 11:03:15 (1 month 4 weeks) Non-repeatingWhy?
@hlorenz, those are the scheduled removal tasks for comments added since the plugin was installed. When the timer is reached, the IP addresses of those comments will be deleted.
From the plugin description:
“IP addresses are kept for 60 days to allow for spam fighting and troubleshooting.”The idea is to only store IP addresses for a short amount of time but to keep them around long enough to help investigate and prevent abuse. Spam fighting plugins need the IP address to detect blocked IP addresses (or addresses added to the blocklist some days after the comment was originally left). The plugin tries to strike a balance between security needs, and data minimisation and privacy.
—-
I’ll investigate the issues with existing comments not having their IPs deleted early next week. There could be a bug if you’re both seeing the same issue here.
Hi @geekysoft,
OK, understood!But still there ist noch change in the old comments IPs…
Looking forward to your bug-check next week ??Ok, my problem is solved now. My mistake was to install with a WP Core version below 4.6. Then I deactivated the plugin again. Thanks to your hint regarding the
remove_comment_ips_firstrun
option I set it to0
again an 6 hours later it worked.Thank you for your help and endeavour!
@berlindave: how did you reset the remove_comment_ips_firstrun option to 0? Sorry, I’m not that deep into wordpress, to easily do that ??
@hlorenz: I did it directly in the database via phpMyAdmin. In the table
wp_options
(or whatever your prefix instead ofwp_
is) I searched in the columnoption_name
for the valueremove_comment_ips_firstrun
and set in the found row the columnoption_value
to0
.I can’t really find anything that would cause the firstrun deletion of existing blog post comments to fail. I don’t know about older WordPress versions, but @berlindave suggests that may be an issue on older versions. If you’ve been running an older and unpatched version of WordPress for some time then you’ve got more serious security issues to deal with than this plugin.
- This reply was modified 6 years, 7 months ago by Dan.
Hm,
I don’t have the line remove_comment_ips_firstrun in my options-database-table…
And I do use the latest WP Version.What else can I do, to get the plugin to work?
This will print the value of the option or “unset” in your PHP error log (usually stored under /var/log/).
$option_value = get_option('remove_comment_ips_firstrun', "unset"); error_log("Value of remove_comment_ips_firstrun is: {$option_value}", 0);
Have a look for other error messages related to the plugin (will likely contain either “remove_comment_ip_handle” or “remove-comment-ips.php” while you’re looking through your error logs. It will help identify exactly what caused the problem so I can work out a proper fix for it.
You can reset the option and try again by deleting it. You should first disable the plugin, run the below code, and then re-enable the plugin.
delete_option('remove_comment_ips_firstrun');
You can run the code by including it in your theme’s functions.php file. Include the code near the top of the file, and save the file. Load your page. Then you can remove the code from functions.php again.
Aha!
One step closer to a solution I think!I used the delete-Code like you explained and now I see lots of cron-events scheduled in 6 hours from now on by remove-ip-plugin.
I hope they will do their job ??I found no errors from the plugin in my error-logs by the way.
But how do I use the first code you postet above?
Where do I put it? Also in the functions.php?Thanks a lot for your help!
Sorry to say, but still nothing happened.
I now see hundreds of cron-events scheduled for in about 8 weeks but still all the old comment-ips in the datatable…
@hlorenz you’re seeing hundreds of “remove_comment_ip_handle” handlers scheduled over the next 60 days about 6 seconds apart? Or are they all scheduled to begin in 60 days from now?
New comments should be scheduled to have their IPs deleted in 60 days from the comment being submitted by a user. Can you test if that works? Submit a new comment, and look for it’s comment_id number in your comment approval panel. Can you find the same comment_id in WP_Cron in about 60 days from now? Then at least that part works.
The only way during the “initial purge” of old comments can be scheduled to be deleted in 60 days instead of 6 hours from installation is if another plugin sends a “post_comment” (new comment posted) signal in the short time interval between the plugin being activated and before it can run the first time. This is a window of a few milliseconds and I see no reason why another plugin would ever want to do that. I’m really confused as to how or why this would be happening.
If you don’t want to wait 60 days for all comments to have their IPS deleted (#GDPRpreparations), you can delete them right away with this little chunk of code in your functions.php file (only works with my plugin installed):
$comments = get_comments(array()); foreach($comments as $comment) { remove_comment_ip($comment->comment_ID); }
This will slow down your site, so include the code snippet, run it, and delete the code from functions.php again. You don’t need to worry about the scheduled tasks that no longer have any IPs to delete. They’ll just disappear when their time comes. (Or you can disable and reenable the plugin to clear them.)
- The topic ‘IPs are not removed after 6 hours’ is closed to new replies.