Dear Vladville Spammers: Suck it

WordPress
Comments Off on Dear Vladville Spammers: Suck it

After deleting the billionth trackback spam from Vladville I figured it was time to do what I do best, wack lines of code until something happens. Thanks to Aksimet and Spam Karma 2 I don’t have a lot of comment SPAM. Yes, every now and then I get to delete one or two but I am at the point where I’m deleting dozens of trackback spams each day.

Trackback SPAM is just spammers way of getting more traffic to their site. They ping the popular blog in hopes that people will accidentally hit the link and end up on their site. Doing a trackback is also very convenient, spamwise, because it does not require them to have an account here, confirm anything or even exist – just put up a blog post and hit pingomatic. Life is good.

Two can play at that game. Here is how you disable trackback linking using WordPress:

/wp-content/comment-template.php

Edit the get_comment_author_link() function and replace it with what I had below.

function get_comment_author_link() {
        global $comment;
        $url    = get_comment_author_url();
        $author = get_comment_author();

        if ( empty( $url ) || ‘http://’ == $url )
                $return = $author;
        else
        {
                if(get_comment_type() == ‘comment’)
                {
                        $return = “<a href=’$url’ rel=’external nofollow’>$author</a>”;    
                }
                else
                {
                        $return = “$author”;
                }
        }

        return apply_filters(‘get_comment_author_link’, $return);
}

Pretty simple. Here is what it looked like before:

        if ( empty( $url ) || ‘http://’ == $url )
                $return = $author;
        else
                       $return = “<a href=’$url’ rel=’external nofollow’>$author</a>”;   

What I have basically done is to add another wrapper around the line of code that returned the author along with a link to their blog. My wrapper checks for the comment type and unless the comment type is a comment (which implies they have a registered account here, that I can nuke easilly if they start to SPAM) I don’t print their URL.

So SPAM away boys, nobody is going to click on your junk from this blog anymore.