Recent Topics

1 Aug 08, 2008 01:02    

My b2evolution Version: Not Entered

A few days ago I was searching for a way do recheck and delete all spam comments with one click and didn't find anything.

So I decided to make a hack ;)

Save this code as hacks.php and upload in conf/ directory. Don't forget to update your spam blacklist before running the script.

if( !empty($_GET['delete_all_spam_comments']) )
	global $Messages, $DB;

	$keywords = $DB->get_results( 'SELECT aspm_string FROM T_antispam' );

	foreach( $keywords as $keyword )
			$r = $DB->query('DELETE FROM T_comments
							  WHERE comment_author LIKE '.$DB->quote('%'.$keyword->aspm_string.'%').'
								 OR comment_author_email LIKE '.$DB->quote('%'.$keyword->aspm_string.'%').'
								 OR comment_author_url LIKE '.$DB->quote('%'.$keyword->aspm_string.'%').'
								 OR comment_content LIKE '.$DB->quote('%'.$keyword->aspm_string.'%') );
			if( $r )
				$Messages->add( sprintf( T_('Deleted %d comments matching &laquo;%s&raquo;.'),
						$r, htmlspecialchars($keyword->aspm_string) ), 'success' );

If you have a few thousands of comments use this query instead or you'll get "Script timed out" error

SELECT aspm_string FROM T_antispam LIMIT 0,500

Type the following in address bar to delete all spam comments/trackbacks


2 Nov 17, 2009 21:21

I tried this, but comments are not deleted. When trying to delete comments manually afterwards i get this:

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/dan18265/public_html/blogs/conf/hacks.php:1) in /usr/home/dan18265/public_html/blogs/inc/_core/_template.funcs.php on line 133

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/dan18265/public_html/blogs/conf/hacks.php:1) in /usr/home/dan18265/public_html/blogs/inc/_core/_template.funcs.php on line 136

4 Nov 20, 2009 16:51

Bookmarking to try soon. I am so sick of all the spam comments.

5 Jun 14, 2011 08:07

In b2evolution 4.1 added options remove all comments and hits matching antispam blacklist.

Tools > Misc > Antispam tools

6 Jan 03, 2012 12:49

It doesn’t stop comments from coming in. It just deletes all pending comments at once. So if you’re sure all your pending comments are spam, then you can get rid of them all very quickly.

7 Mar 10, 2012 14:30

I can't access the file sam2KB suggested back in 2009. Is there a more recent file to delete-stop spam? I really just want to turn off the ability for users to post comments temporarily. I am using version 4.05 and there is NO WAY I'm going through all the hassle of upgrading.

Form is loading...