Hi, thank you for reaching out to us. I have submitted a message to the developers to investigate further your request.
Kind regards
Thread Starter
jkdev
(@jkdev)
@mbrsolution Hello, just checking in on this. Thank you.
Hi @jkdev,
“Delete All Failed Login Records” from all the sites on the network at once
Short answer is no there isn’t.
But there is a filter hook which controls how many rows are kept in the aiowps_failed_logins table. You could add some code in your functions.php file and set the number of rows to 0.
The filter is defined inside the wp_security-backup.php file as follows:
$max_rows_failed_logins_table = apply_filters( 'aiowps_max_rows_failed_logins_table', $max_rows_failed_logins_table );
So you could hook into the above filter from your functions.php and return a value of 0 for the $max_rows_failed_logins_table.
Your table rows will then get deleted when the aiowps hourly cron task eventually fires.
ps: you could speed up the process and network deactivate and reactivate the aiowps plugin and then visit each of your subsite home pages to trigger the cleanup task.
After you’ve cleaned up the tables you might want to comment out the code from your functions.php file if you don’t want that table to be continually emptied.
Thread Starter
jkdev
(@jkdev)
@wpsolutions Hello, thank you for the info. I tried to do this, and couldn’t get the hook to work. Do you think it would be possible for you to give me exactly what I need to add into the functions.php file?
Thread Starter
jkdev
(@jkdev)
Looks like I got it working. This is what I added to my functions.php. Does this look correct?
function clear_security_failed_login() {
$failed_logins_table_name = AIOWPSEC_TBL_FAILED_LOGINS;
$max_rows_failed_logins_table = '10'; //Keep a max of 5000 rows in the events table
$max_rows_failed_logins_table = apply_filters( 'aiowps_max_rows_failed_logins_table', $max_rows_failed_logins_table );
AIOWPSecurity_Utility::cleanup_table($failed_logins_table_name, $max_rows_failed_logins_table);
}
add_action('aiowps_perform_db_cleanup_tasks', 'clear_security_failed_login');
-
This reply was modified 6 years, 8 months ago by
jkdev.
Hi @jkdev,
It’s not quite right in the sense that you are not hooking into the “filter” I mentioned earlier, but you are hooking into an action hook. So I guess it is an alternative way to clear out that table.
However I recommend that you use the filter I mentioned earlier.
You will need to use the “add_filter” function because you are hooking into a filter not an action hook.
Here’s an example which will clear all rows except 5:
add_filter('aiowps_max_rows_failed_logins_table', 'modify_max_rows_failed_logins', 10, 1);
function modify_max_rows_failed_logins($max_rows) {
return 5;
}
@jkdev, did the solution provided by wpsolutions helped you in any way?
Thank you
Thread Starter
jkdev
(@jkdev)
@wpsolutions @mbrsolution I was just able to test it out and it works perfectly. Much better than what I had. Thanks for the help!!!