Wordpress spam comments don't disappear from Recent Comments
January 28, 2006 5:32 PM

I have a WordPress blog (linked on my profile page if that's helpful). It is set up to notify me when there are comments on postings. I've been getting spam comments and deleting them. They disappear from the post where they appeared. However, they DON'T disappear from the "recent comments" module on my homepage. This module contains a link to the spam URLs they are propagating. I know some SQL but almost no PHP. Is this a common problem? Any suggestions?
posted by scarabic to Computers & Internet (11 answers total)
What plugin or code snippet is generating the recent comments thing? Are you using a staticizing plugin?
posted by Firas at 5:51 PM on January 28, 2006


This isn't really an answer since I don't use recent comments on my wordpress blog (although I'd love to!), but something I would try. . . have you republished the whole site after you delete the comment?
posted by visual mechanic at 6:22 PM on January 28, 2006


When I delete spam it does disappear from the recent comments module as well. So I would second Firas' question.

You shouldn't have to "republish" anything.
posted by litlnemo at 7:05 PM on January 28, 2006


In fact, I can't think of a Wordpress release that ever had a "republish" option - sounds like a Blogger feature...

It sounds like the recent comments plugin is caching the comments, so you need to look refreshing the cache. Check out the "Readme" that came with the plugin, or the plugin page. If you tell us which plugin you're using, it would probably help as well.

If you're using Fuzzy Recent Comments, try this:

http://www.scarabic.net/?action=flush

Thinking aloud
Manual way to do this would probably be to open up your MySQL database, and search for the plugin's table, then manually delete the offending entries (I would imagine they've been put into a table - this is all hypothesis).

Failing all else, the Wordpress Support Forums are always filled with wonderful people who could help.

(P.S - Akismet is pretty darn good at stopping spam - all you need is a Wordpress API key to use it on your own install. Think you need WP 2.0 though, so if you're still running 1.5.2 then you'll have to look at other options. Check out Podz' guide and the WP Codex Page)
posted by djgh at 8:16 PM on January 28, 2006


I dunno what plugin/code manages the "recent comments" thing. I don't see anything in the plug-ins list which relates to comments, nor do I recall installing WP plugins of any kind. I appear to have a default set of 3 plugins. The front page is a template I got from somewhere long ago (don't recall where) and which I can only barely manage to tweak (no PHP skillz).
posted by scarabic at 9:00 PM on January 28, 2006


Which of those 3 plugins are active, and could you post your index.php and sidebar.php at http://pastebin.com/ ?
posted by Firas at 9:08 PM on January 28, 2006


Scarabic, I'm not a PHP expert, and I haven't dug into the guts of WordPress, but I looked at your source markup, and it showed me that you're using the Devenir En Gris theme for your blog. I downloaded the theme and looked in the sidebar.php code for your "recent comments" code. And this is what I got:

<?php

global $comment;



if ( $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved='1' ORDER BY comment_date_gmt DESC LIMIT 5") ) :

?>



<li id="lastcomments"><div class="menutitle"><?php _e('Comments'); ?></div>

<ul>

<?php

foreach ($comments as $comment) {

echo '<li>' . sprintf('%s <span style="text-transform: lowercase;">on</span><br />%s', get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');

echo '</li>';

}

?>

</ul>

</li>

<?php endif; ?>




If any of the other WordPress or PHP gurus can take a look at that and see what's screwing up, you might have your answer. At casual glance, it seems to be selecting only those comments where the comment_approved flag is set to "1" (true/yes) which should work.
posted by madman at 9:40 PM on January 28, 2006


Would I be correct in assuming you are using the Devenir en Gris/Fade to grey template? If so, that includes the recent comments code as default, so it isn't a plugin.

If it is that theme, then it would appear (and people with greater PHP and WP skills than mine can confirm or deny) that it's calling the comments from the default Wordpress table for comments - in other words, they're still in your database.

(On preview - gah, beaten to the punch. And it would appear it took me ten minutes to make this comment.)
posted by djgh at 9:53 PM on January 28, 2006


Perhaps compare your sidebar.php section dealing with recent comments with the default?
posted by djgh at 10:18 PM on January 28, 2006


Devenir en Gris

Yes, that sounds right. I think the next step is to check if the comments exist in the db or not. I'll have to start poking around there.
posted by scarabic at 12:43 AM on January 29, 2006


The comments were still in the DB so I just deleted them.

it seems to be selecting only those comments where the comment_approved flag is set to "1" (true/yes) which should work.

They had the flag comment_approved set to "spam" so I don't know how they continued showing up. I think I will moderate a little differently from now on - just delete stuff instead of marking it as spam.

Thanks all! And thanks to the geniuses who created PHPMyAdmin.
posted by scarabic at 12:10 PM on January 29, 2006


« Older Looking to buy a shortwave radio in Australia   |   Can protein powder go off? Newer »
This thread is closed to new comments.