=== Zarin Comment Spam Cleaner ===
Contributors: zneugebauer
Tags: comments, spam, cleanup, moderation, bulk delete
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Safely preview and remove spam comments by Cyrillic text, keyword, link count, email domain, date range, or commenter name.

== Description ==

Zarin Comment Spam Cleaner gives site moderators a focused cleanup screen under Tools > Comment Spam Cleaner.

It can find comments and product reviews that match any of these filters:

* Russian/Cyrillic characters in the comment text or commenter name.
* A keyword or phrase in the comment text.
* A minimum number of links in the comment text.
* The commenter's email domain.
* A selected comment date range.
* Exact commenter names or registered WordPress usernames.

Every filter is optional and a comment is selected when it matches any single enabled filter — you only need to turn on the ones you want. A whitelist lets you protect specific commenters (by name, username, or email) from ever being matched, even if they trip another filter.

The plugin shows a preview before changing anything, and the full matching set can be exported to CSV for your own records before you confirm a cleanup. Moving matches to the WordPress Trash is the default action. Permanent deletion is available only after choosing it explicitly and confirming the preview.

Cleanup runs in batches of up to 100 comments to reduce timeout risk on sites with large comment tables. The preview is frozen at the newest comment ID that existed when it was created, expires after 24 hours, and does not unexpectedly include newer comments.

The plugin does not send comment data to an external service and does not run automatic background deletion.

== Installation ==

1. Upload `zarin-comment-spam-cleaner.zip` through Plugins > Add New > Upload Plugin.
2. Activate Zarin Comment Spam Cleaner.
3. Go to Tools > Comment Spam Cleaner.
4. Choose one or more filters and select whether matches should go to Trash or be permanently deleted.
5. Preview the matches and review the sample comments.
6. Confirm and process the cleanup batches until no matches remain.

== Frequently Asked Questions ==

= Does the Russian-text filter detect only Russian? =

It detects Cyrillic characters commonly used in Russian. Because other languages also use Cyrillic, review the preview before removing comments.

= How are multiple filters combined? =

They use an "any" rule. A comment is selected if it contains Cyrillic text, falls within the chosen date range, or matches one of the exact commenter names/usernames.

= What does the username filter match? =

It matches the comment's exact author name. For comments from registered users, it also matches the user's exact WordPress login username.

= What comment types are included? =

Standard WordPress comments and product reviews are included. Pingbacks, trackbacks, WooCommerce order notes, and other internal comment types are excluded.

= Can a commenter be protected from every filter? =

Yes. Add their exact name, username, or email to the whitelist field. They are skipped even if they match a filter above.

= Can I see everything before it's removed? =

Yes. Beyond the on-screen preview sample, you can export the full matching set to a CSV file before confirming a cleanup batch.

= Can I undo a cleanup? =

Comments moved to Trash can be restored through the normal WordPress Comments screen. Permanently deleted comments cannot be restored unless you have a database backup.

= Does the plugin automatically delete future comments? =

No. Cleanup happens only when an authorized moderator creates a preview, confirms it, and processes a batch.

= Does comment data leave the site? =

No. All matching and cleanup happen inside the site's WordPress database. The plugin has no external service or tracking connection.

== Privacy ==

This plugin does not collect, transmit, or share personal data. It reads existing local comment and user records only when an authorized moderator runs a preview or cleanup.

== Screenshots ==

1. Choose Russian/Cyrillic, date-range, and exact commenter-name filters, then select the safer Trash action or permanent deletion.
2. Review the match count and sample comments before confirming each batched cleanup action.

== Changelog ==

= 1.1.1 =
* Restructured comment-matching SQL so every dynamic value is bound via its own wpdb::prepare() call at the point it's introduced, instead of being collected into a separate array applied later. Same query behavior, easier to audit.

= 1.1.0 =
* Added keyword/phrase, link-count, and email-domain filters.
* Added a whitelist to exclude specific commenters from every filter.
* Added CSV export of the full matching set from the preview screen.
* Clarified that every filter is optional throughout the filter screen.
* The browser tab title now distinguishes the filter step from the review step.
* Review-table comment links now open in a new tab so the preview isn't lost.

= 1.0.0 =
* Initial release with Cyrillic-text, date-range, and commenter-name filters.
* Added preview samples, Trash and permanent-delete modes, and batched processing.
