Home > Geek Speak > My First WordPress Plugin! [Comment Replacement]

My First WordPress Plugin! [Comment Replacement]

September 16th, 2008
Your Ad Here

Last night someone posted a profane comment and I was forced to replace that comment with a warning that the comment has been removed for so and so reasons.

A friend (Awais Karim) then commented asking whether I modified that original comment or was it a feature of the blog? With an empty stomach and a lot of time for Iftar, an idea of automating this process with the help of a WP plugin rushed through my mind. And believe me, without knowing much of PHP, I actually DID manage to create this plugin (within fifteen minutes) which I am proud to announce :D

So what does the plugin do? An array of unwanted words is maintained in a list. If the comment contains any of those words, the WHOLE comment is replaced by text of the webmaster’s choice.

For example, the list contains the following words: shit, sex, bitch

Someone comments: shoaib akhtar is a son of a bitch

Comment that appears on site: Shut Up!!

It’s not very intelligent, but hey I made it myself!!! A very useful video tutorial of making your own plugins is here.

I will put it up tonight (after eating something!!) together with a guide of how to use it.

BTW, I don’t know if such plugin is already available. Also, I haven’t named it yet [abhi abhi paida hua hai] so all suggestions are welcome!

Your Ad Here

Share/Save/Bookmark

Geek Speak , , ,

  1. Asad
    September 16th, 2008 at 20:03 | #1

    How about calling it: “shoaib akhtar is a son of a bitch”

  2. Asad
    September 16th, 2008 at 20:04 | #2

    Or, “No Zardari Panna Allowed”

  3. September 17th, 2008 at 06:07 | #3

    How do you plan on dealing with variances of the same word. For e.g, in one of the above cases: sh1t, shitt, sh*t etc. etc.

  4. Awais Karim
    September 17th, 2008 at 06:39 | #4

    well it seems that ur plugin has failed as the first message is still there…or u haven’t updated it…what ever the problem is congrats on making ur first plugin :)

  5. September 17th, 2008 at 13:00 | #5

    Yeah it’s not yet active. Well, variances of the word is a good aspect. Probably I’ll add them once :D but another problem is that sometimes these words are used in the lighter sense as well :)

    The primary purpose is to deal with only a handful words which go to the extreme and usually no one misspells them *wondering why?*

  6. September 26th, 2008 at 15:05 | #6

    Nice.

    By the way, WordPress provides you with a way of blacklisting comments based on the words your provide it. It’s very crude though, and doesn’t have a “Shut Up!!” message as well. :)

    And hey, “Shut up!” is a good name! Perhaps if you really work on it and add some more strong techniques for filtering and stuff, you could release it publicly on WordPress Plugin directory.

  7. September 26th, 2008 at 17:45 | #7

    @Saadat: I’m trying to make it robust. Perhaps, it needs more time. Yeah, if it takes a proper shape, Shut up! will probably be the name :D

  1. No trackbacks yet.