Userscript to make banning MediaWiki spammers easier

Somehow, I’ve come to be responsible for administering two MediaWiki-powered wikis. The main burden is having to ban spammers, which sometimes sign up in batches of 20 at a time.

To help with process, I’ve put together the following browser userscript. On Firefox, you can easily set it up using the Greasemonkey extension. Opera and Chrome have their own facilities.

The script basically makes the default values on the user ban form sane, so I can just click through without fiddling with dropdown and checkboxes. Obviously, the ban has to be permanent. Obviously, I don’t want spammers emailing anyone.

I’ve been hearing wonderful things about userscripts for years, but this is the first one I’ve put together for myself. It’s actually very easy to write these, assuming you know Javascript and have tools like Firefox’s Web Console and the Web Developer extension handy.

I’m planning to enhance it a little so that it handles the slightly different form for banning anonymous users, but I’m not sure if it makes sense to submit to any official repository. It helps with running small wikis that have open memberships, so there isn’t any one site I can identify it with. Obviously, it’s not suited for Wikipedia, as they have a very different set of problems.

Edit: Updated the script with better handling for banning anonymous users by IP address.

  • Pingback: Userscript for faster deletion of MediaWiki spam | Leons Tech Blog

  • Liam Dolman

    I had issues using this off the bat as & was transformed into & so if anyone else has issues just change:

    [code]
    if (expiryNodes[i].label && expiryNodes[i].label in {infinite:1, indefinite:1}) {
    index = i;
    }
    [/code]

    to

    [code]
    if (expiryNodes[i].label && expiryNodes[i].label in {infinite:1, indefinite:1}) {
    index = i;
    }
    [/code]

    and everything should work great! Thanks for this script!