The Blackboard

Where Climate Talk Gets Hot!

Skip to: Content | Sidebar | Footer

Troll Control: Help me test my Wordpress Plugin

5 January, 2009 (11:05) | Wordpress Plugins Written by: lucia

Every now and then, blogs attracted visitors who are less than well behaved. These visitors may sometimes say useful things sometimes, but they also have a tendency to start fights. In fact, reading their comments, one often suspects they actually want to start fights rather than advance any conversation.

These visitors are known as “Trolls”. They are difficulty to deal with.

To make it a little easier to deal with the occasional troll my blog attracts, I have written and inconvenient to use Wordpress plugin. The benefits of the plugin are, after you upload and activate the plugin:

  1. For the first “N” minutes, the comments from individual trolls will display to the troll only. After that, they will display. This permits the trolls to participate in conversations to some extent, but also gives you time to edit or delete the more egregious aspects of the comment.
  2. You can add multiple trolls.

The inconvenient features of this plugin will be obvious: You need to manually edit your theme and some of the plugin code.

Steps to use plugin

  1. Click to download the plugin Troll Control Plugin (zipped).
  2. Unzip the plugin. Near the top of the plugin find a block of code that looks like this:

    // edit parameters in parameters in the next four lines block to match any INDIVIDUAL troll.
    $the_troll_names=array('Troll','Troll Sock Puppet');
    $the_troll_email=array('troll_email@gmail.com');
    $the_troll_IP=array('99.99.99','77.77.88.13' );
    $the_troll_opt['the_troll_minutes'] =300;
     

    $the_troll_opt['IPs']=$the_troll_IP; // don't edit.
    $the_troll_opt['the_troll_name']=$the_troll_names; // don't edit.
    $the_troll_opt['the_troll_email']=$the_troll_email; // don't edit.
    array_push($the_trolls_parameters,$the_troll_opt); // don't edit. this adds your troll with all his descriptors to the list of trolls
    // END BLOCK.

  3. Edit the first four lines to identify your troll. If your troll visits using the name “Mike” change array(‘Troll’,'Troll Sock Puppet’) to array(‘Mike’). Edit the emails, and IP addresses accordingly. You can have more than 1 identifier in any field.
  4. Decide how many minutes you want to delay the troll. I set 300 minutes as the default. This way, I can go to bed at night and reduce the risk of troll eruptions. Don’t delay more than 3 days. To save CPU the plugin skips comments more than 3 days old. (If someone needs to be delayed more than 3 days, you should just ban them.)
  5. If you have a second troll, copy the whole block, re-paste, the edit.
  6. Save the edited file.
  7. Back up your version of WP. (All instructions for uploading plugins say this as a precaution.)
  8. Upload into your plugins directory and activate. It will seem nothing happens.
  9. Visit the design to edit your Wordpress theme. Open your comments.php file. Find the “foreach” statement (or whatever php command your theme editor used. Add two lines of code to set a value a variable I named $block. It should look sort of like this:

    foreach ($comments as $comment) :

    if(function_exists('Check_The_Troll') ){$block=Check_The_Troll();}
    else{$block=0;}

    Now, find the bit of code that actually displays your comment author, email, comment numbers and the comment. Wrap an “if” statement around that, sort of like this:

    if($block!=1){
    PUT All CODE TO DISPLAY COMMENTS IN HERE
    }

    If done correctly, the troll control rules will now be enforced. If you don’t know any php, and can’t tell where php code starts and html code begins, get a friend to do this for you.

When this is running during the “troll time out” period, the blog owner will see the troll comments, along with some information added to let you know it is a troll comment. The troll will see the comment and will think others are seeing it. No one else will see the comment.

If you don’t answer the troll, this functionality enforces the “Don’t feed the troll” rule. If this plugin is not enough to deter your particular troll, you will need to escalate to banning the troll.

After I’ve fully tested this inconvenient plugin, I’m going to create a user interface to help bloggers add and subtract troll data more easily. However, users will always have to edit their theme a little. I’ve also modified the “get_recent_comments” plugin and “subscribe_to_comments” plugin to further isolate the troll. I’ll explain those modifications when this is perfected.

Do me a favor!

This plugin is currently running at my blog. I tested it at my testblog, but there are always limits to self-tests. You could help me test the plugin by entering a comment and claiming your name is “Troll” or “Troll Sock Puppet”. Then email a friend and ask them if they can see your comment.

Report back!

Update
1:07 pm. It looks like a number of Troll Sock Puppets have appeared. Thank you. I noticed the comments were properly “disappeared” in comments, but appeared under “recent comments” in the sidebar. I modified the recent comments plugin and now I don’t see them there either.

1:23 Comparison of comments seen by admin and by non-troll visitor. (Click for larger.)

Figure 1: Comments as seen by logged in administrator.

Figure 1: Comments as seen by logged in administrator.


The comments that have been “troll controlled” appear to the troll, and, unless deleted by the moderator, eventually appear to the full audience.

Figure 2: Comments as seen by non-trolls.

Figure 2: Comments as seen by non-trolls.

Written by lucia.

Comments

Terry (Comment#8061)

Cool stuff! Given this past weekends activities, Jeff Id’s blog would be a great test site methinks :)

lucia (Comment#8062)

Terry–
If Jeff Id wants to use it, he’s welcome. I don’t visit blogs much on weekends– and last weekend we were pretty busy. Also, I was checking some “tweaks”.

Now I better go visit Jeff’s blog to see if there was a troll outbreak or just a disagreement!

Troll Sock Puppet (Comment#8063)

You are nothing but a paid shill for Big Oil!

lucia (Comment#8064)

Terry–
I visited Jeff’s blog. I’m afraid Jeff Id probably can’t use the plugin. It works if you use wordpress on a self hosted blog. But wordpress.com will host a blog for free but I think they won’t let you add your own plugins.

lucia (Comment#8065)

Troll SockPuppet visited! Yay.

Terry (Comment#8066)

I think he’s in China this week, so it may take a bit. If you spin through the “Noconsensus Baby!” thread, you’ll probably see pretty quickly it wasn’t a disagreement, per se. Great blog, btw, Happy New Year and keep up the good work!

Troll Sock Puppet (Comment#8067)

I protest! :wink:

Andrew ♫

CoRev (Comment#8075)

Lucia, what kind of test do you want us to perform? Want me to cuss out Terry? Or Yourself? Use profanity? Or just be my mild mannered self?

lucia (Comment#8076)

CoRev–
I just need to make sure comments that match the parameters I hard coded into the plugin do show to the person who posted but don’t show to others.

So, fill out a comment and do any of the following:

For Name enter “Troll” or “Troll Sock Puppet”.
For email enter “troll_email@gmail.com”

If you know how to spoof IPs (and I don’t) try to leave a comment with the ip 77.77.88.13 . (Actually anything starting with 77.77.88.13 will do. If you leave 77.77.88.131, the plugin should think you are a troll.)

After you enter your comment, click submit.

YOU should see the comment.
If you look at Recent Comment in the sidebar, your comment should NOT appear there.
If you ask a friend connecting with a different IP than yours they should NOT see the comment.

There are some ‘features’ if, after commenting as “Troll”, you switch back to CoRev. But don’t worry about those. :)

Troll-- NO longer a troll! (Comment#8077)

Testing, 1 2 3

Terry (Comment#8078)

Just tested the sidebar using Troll / troll_email@gmail.com and everything worked (ie didn’t show up) as expected.

lucia (Comment#8081)

Terry. Your followon comment as Terry teseted an additional feature– and it worked. On *this* post, the plugin is now watching for your IP and treating it as troll. (This won’t happen on other posts, and only becomes active if I do something intentional. The purpose of the feature is to prevent people from just switching to different names and email combos.)

Everything is looking pretty good. Next, I have to check whether “subscribe to comments” works right. (I’ll need to subscribe myself.)

Terry (Comment#8082)

Cool! I noticed too that at first my follow-on didn’t show up in the side-bar, but didn’t know if it was because of an IP address, or that I included the troll e-mail in the message body. Then I kicked myself for that by allowing more than one factor into the little experiment :)

lucia (Comment#8083)

Hmmm…. but this one is showing in the sidebar but the admin view is saying it’s still detecting you. Gotta see what’s up with that!

lucia (Comment#8084)

Ahh… shucks. The “get_recent_comments” filtering is a mess. I’ll have to think that out a bit more. (The problem is that I need to sit down and figure out exactly where it filters and assembles the cached comments. There are multiple snafus there.)

Terry (Comment#8087)

Happy debugging!

lucia (Comment#8093)

Terry– It’s sort of randomly sticking things in the “get_recent_comments” cache.

Hhmmm this conversations is going to look really weird to others since I’m responding to comments that don’t appear. Heh! (Normally, I’d just ignore the comments from people marked as trolls. I better go clear out the IP from the comment you posted as a favor to me.)

Terry (Comment#8094)

It *shouldn’t* be randomly doing anything – one of the things I love about programming. And it is funny if all of my posts are disappeared and it looks like you’re talking to yourself – I’ll go fire up another computer and see what it looks like from there.

lucia (Comment#8095)

Well… not actually radomly. I was lazy and …. didn’t actually print out the get_recent_comments.php plugin and trace through where to put the bits that recognize the new comment is from a troll and kept it out of the “recent comments” bit in the sidebar. So, I just sort of looked convinced myself the logic belonged in one particular place and now the recent comments area shows comments in some weird (not actually random) order!

I untrolled you by stripping the name and time. The “IP” feature worked. You’ll see your comments now.

Terry's other 'puter, e-mail, and IP (Comment#8096)

I see me. You must have cleared the IP. Good luck with the filtering stuff – if we hadn’t forsaken Smalltalk, none of this would be a problem and the world would be troll-free. Honest. :D

Rich (Comment#8139)

Couldn’t you just ask Big Billy Goat Gruff to deal with it?

TCO (Comment#8143)

:(

lucia (Comment#8146)

Rich–
Even Billy Goat Gruff needs tools.

Plugin Wordpress para los Trolls (Pingback#13337)

[...] Por ejemplo este plugin de Wordpress nos puede servir. [...]

 

Comments Closed: If you would like them re-opened, Contact Lucia