Delete Comment Spam From Gallery

Updated about 1 yr, 4 mths ago (July 27, 2023). Know a better answer? Let me know!

Mass-delete comment spam from Gallery

Ever woken up to find your Gallery full of comment spam? Ever tried deleting the comment spam, one by one? Not good...

Here’s how to delete it directly from the database, all at once (for Gallery 2.x).

You will need access to the database running behind your Gallery. This can often be through phpMyAdmin in cPanel or similar.

You’ll need to change the parts in bold to match what you’re trying to delete. Note that a % is a wildcard in SQL, so matches anything. For example, ‘%a%’ would match anything with an ‘a’ in it, and ‘209.31.123%’ would match anything starting in ‘209.31.123’.

To delete comments posted by an IP, or a few IPs, run this SQL statement:

delete ce, e, co from g2_ChildEntity ce, g2_Entity e, g2_Comment co where ce.g_id=e.g_id and e.g_id=co.g_id and e.g_entityType='GalleryComment' and (co.g_host='67.104.112.176' or co.g_host='209.31.123.128')

To delete comments based on the comment itself, run this SQL statement:

delete ce, e, co from g2_ChildEntity ce, g2_Entity e, g2_Comment co where ce.g_id=e.g_id and e.g_id=co.g_id and e.g_entityType='GalleryComment' and (co.g_comment like '%[url=http://%')

To delete comments by a specific author or authors, run this SQL statement:

delete ce, e, co from g2_ChildEntity ce, g2_Entity e, g2_Comment co where ce.g_id=e.g_id and e.g_id=co.g_id and e.g_entityType='GalleryComment' and (co.g_author like '%ialis%' or co.g_author like '%iagra%')

More Information

Fore more information on:

 

Updated about 1 yr, 4 mths ago (July 27, 2023). Know a better answer? Let me know!

Related categories [coloured].

User submitted comments:

Akom, about 16 yrs, 2 mths ago
Monday September 29, 2008 1:38 AM

Saved me tons of time. Though in the end it turned out that I had nothing besides spam! :)
Thanks for posting this.

anon, about 14 yrs, 11 mths ago
Saturday December 26, 2009 6:00 AM

Thank you! This saved me a bunch of time.

Comment on this article (no HTML, max 1200 characters):