As we know, BlogSpot comment system is integrated with its default comment system that easily lets a commentator leave spam comments like promoting links, writing abusing words and much more. However, Blogger blogs give you the freedom to review the comments before they appear on your blogs.
Check out: How to Get Missing Comment Thread Work in Blogger
There are several reasons you want to ban a user from commenting on your blogger blogs, and one of the reason is to prevent the blogs from spam commentators who frequently send the comments that are considered unethical, rude, contains slander or promotional links which are not good enough to be displayed. To avoid these things occur in future, you need to add a simple jQuery code to your blogger template that will permanently put a spam commenter on the blacklist.
Pay Attention: How to Add Multiple Set Column to Blogger Posts
Spammers engage in this activity in the hope that they can improve their search engine rankings. A few of them carry these tasks because they are not aware of the disadvantages of spam commenting.
Recommended: jQuery Tabs and Accordion for BlogSpot Blogs
To permanently ban a user from commenting on your blog, you have to find his Blogger Profile URL to stop the spammers from accessing your comment form. If you are among those bloggers, who do not have any idea how to tackle the spam commentators, then you are lucky here.
Banning Spam Commentator With jQuery
- Go to Blogger > Theme > Edit HTML
- Add the jQuery code just above the </ body>
- Click Save Theme
<script type='text/javascript'>
//<![CDATA[
var spamlist=[
'http://www.blogger.com/profile/xxxxxxxxxx', /* Commentators URL */
'http://blog_name.blogspot.com/', /* Commentators blog URL */
];
for(var v=0; v<spamlist.length; v=v+1){
$("a[href='"+spamlist[v]+"']").each(function(){
$(this).closest(".comment-block").find(".comment-content")
.replaceWith("<div class='comment-content' style='color:red'>You have been banned!</div>"),
$(this).replaceWith("<span style='color:red'>BANNED USER!</span>");
})
}
//]]>
</script>
If the above code does not work for your template, you can try this one:
<script type='text/javascript'>
//<![CDATA[
var spamlist=[
'http://www.blogger.com/profile/xxxxxxxxxx', /* Commentators URL */
'http://blog_name.blogspot.com/', /* Commentators blog URL */
];
for(var v=0; v<spamlist.length; v=v+1){
$("a[href='"+spamlist[v]+"']").each(function(){
$(this).closest(".comment_inner").find(".comment_body")
.replaceWith("<div class='.comment_body' style='color:red'>You have been banned!</div>"),
$(this).replaceWith("<span style='color:red'>BANNED USER!</span>");
})
}
//]]>
</script>
Banning Spam Commentator With Conditional Tag
- Go to Blogger > Theme > Edit HTML
- Search for the following piece of code inside your theme editor
- Add the given conditional tag right below it
- Now locate the </b: loop> and paste the following code just above it
- Finally, click Save Theme and you are on the go
<b:loop values='data:post.comments' var='comment'>
<!--Banned-->
<b:if cond='data:comment.authorUrl != "http://www.blogger.com/profile/12345678910"'>
<!--Banned-->
<!--Banned-->
</b:if>
<!--Banned-->
Before you save your theme, kindly replace the blue text with spammer's blogger URL.
Great tip.
ReplyDeleteThank for sharing !
You're welcome! Keep visiting
Delete