DerekAllard.com

Member Banning ExpressionEngine snippet

When spammers do sneak comments through my blog, I have a very simple one click* snippet to ban them similar to the way the EE forum’s “ban member” option works. Essentially, beside every comment, I have a “delete & ban” link. This saves me needing to fire up my control panel, and navigate to the proper place. It just saves a bit of clicking around.

I never thought much of it, but yesterday it co-incidentally came up when I showed another EE dev my site’s control panel for something totally unrelated. Since I implement the “one click delete” in a snippet, I thought I’d share it here:

{if can_moderate_comment}
     [ 
<a href="{cp_url}?S=0&D=cp&C=addons_modules&M=show_module_cp&module=comment&method=index&entry_id={entry_id}">delete &ampban</a]
{
/if} 

And then in my template

{exp:comment:entries}

    
<p>{url_as_author} wrote{ban_member_snippet}</p>

    
{comment}

{
/exp:comment:entries} 

I’ve used this sucker for so long I forgot all about it. If you have any “go to” snippets, code or tricks, please post them in the comments here!

* Technically its probably 2 or 3 clicks :)

Comments

John_Betong wrote on

Many thanks for the neat solution.

I have recently been inundated with spam and now now actually looking forward to removing the junk.

Best Wishes

curtisblackwell wrote on

thought this should be a gist on github: https://gist.github.com/1508537

Derek wrote on

Neat idea Curtis. Thanks!

Spammer McSpamerson wrote on


Don’t you understand that it is the best time to get the [redacted], which can make your dreams come true.

Derek’s edit: Sigh… I can’t even get spammers to stop in this blog post…

curtisblackwell wrote on

perhaps you should add a honeypot to the comment form.

web man wrote on

Akismet, Mollom or other banning software are on the web. Wordpress uses Akismet and Drupal uses Mollom as I saw.

Can we integrate such comment banning system into ExpressionEngine?

Derek wrote on

Can we integrate such comment banning system into ExpressionEngine?

Boy do I have a treat for you :) Greg Salt, well known in the EE community has just launched Project Cerberus. I’m hopeful it will become the “Askimet of EE”.

EE Surgery wrote on

Handy little snippet, thanks Derek.