Gregs Plugins: Because One Size Does Not Fit All

Plugins for WordPress

Greg Mulhauser

Limit the Length of Comments Left on Your Blog with this Plugin

This new WordPress plugin provides a configurable limit on the length of comments left in the comment form, with a character countdown displayed for the user and dynamically updated with each keypress.

gcll-options

NOTE: This article was originally published on the Psychology, Philosophy and Real Life blog and was later moved here to GregsPlugins.com.

When this plugin was originally released, the full contents of the 'README' file were provided here in this article. Since the contents of the 'README' file evolve over time, I have now removed the original version but have kept this stub posting so as to preserve the comments which were made at the time.

IMPORTANT UPDATE: This plugin now has a newer version! For information on subsequent releases, please see the update announcements here:

41 Responses (13 Discussion Threads) to “Introducing Greg’s Comment Length Limiter Plugin for WordPress”

  1. avatar image
    Neil Prestemon
    11

    Well, it’s not working for me; I’m using a modified version of “Generic Design” template. The box appears, my limit of 1000 is in there, but there’s no response.

    I inserted the code and I get the following printed INSIDE my comment box:
    onkeydown=”gcllCounter(this)” onkeyup=”gcllCounter(this)”

    My comment form’s name is “comment” and so is the id. When I tried to change it to “commentform” – suddenly, it would no longer submit the post. The button would press and nothing.

    So I guess my question is: is there somewhere else I need to change “comment” to “commentform” so that changing this name does not break my submission?

    • 11.1

      Hi Neil,

      As you haven’t mentioned the URL for the site where you’re having trouble, I can’t offer any direct feedback on the site itself. However, from what you’ve described, as far as I can tell, you just need to go back for another take on the instructions…

      The “Generic Design” template, if it’s the one which goes by that name at the WordPress theme repository, does not have a comment form with either a name or an id of ‘comment’ — although it does have a textarea by that name. The form tag, however, has an id of ‘commentform’ but no name. As indicated in the instructions, it needs one.

      Regarding the JavaScript appearing INSIDE your comment box, if you have another peek at the example given in the README file, you’ll see where the code needs to go — not between the tags, but inside the tag. As it happens, the relevant portion of comments.php from your theme is actually identical to the example given in the README file, so you can literally copy and paste from one to the other.

      All the best,
      Greg

  2. avatar image
    Neil Prestemon
    12

    I see what I did wrong. There was an extra closing tag, and I deleted it, but that should have been my clue that I wanted to get rid of the closing tag from the <textarea parameters – I did that, and I added a name parameter to the form. That did the trick.

    I couldn’t send you a url for the site yet, because it’s still in development, and not yet public. We haven’t assigned a public address to it yet; but this plugin feature is very handy – I’m demoing it to my customer so they can see if they want to use it.

  3. 13

    Hi there! It worked fine with WP 2.8.4 and Arclite 1.5.4 theme. Yes, I had to modify theme’s comments.php. The only problem – in WP admin “Plugins” has a red circle with number “1″ in it righ after activation of the plugin. And plugin’s setting are not available – it only shows small “tools” icon

    • 13.1

      Hi Aleksandr,

      Hmmm, if you check my reply to another recent comment at the following URL, I mention that the ‘disappearing options’ problem only seems to have been reported in cases where WP’s built-in auto-upgrade system has failed to perform properly:

      http://counsellingresource.com/features/2009/01/27/threaded-comment-numbering-plugin-for-wordpress/#comment-50900

      I’d recommend the suggestions from that reply.

      Some people are also getting hassles from WP 2.8′s higher memory requirements. If you’re affected, you can open up your wp-settings.php file and change WP_MEMORY_LIMIT from 32M to 64M.

      With regard to the red circle after “Plugins”, that’s WP’s built-in system letting you know whether any of your plugins need to be updated. If you visit your plugin admin page, you’ll see a notice if there are new versions available of any of your plugins. (That red circled number doesn’t always update straight away. It may take a few more clicks around your admin panel before it shows correctly.)

      All the best,
      Greg

  4. avatar image
    Hector
    14

    I’ve used your plugin in my site…. work fine, but never display the counter diminishing the characters while I am writing.

    I see that in your site the counter is diminishing in real time the “characters available”, What can i do for work this feature?

    Thanks for your quick assistance.

    • 14.1

      Hi Hector,

      Without any further details to go on, the best I can suggest is to double-check that you have followed the instructions fully, including ensuring that your comment form has a name attribute of commentform and adding the required template tag/function call within the appropriate textarea tag.

      All the best,
      Greg

  5. 15

    Greg… sounds like a great plugin, and exactly what I need (I’ve got a couple of loyal readers who are wonderful, but are fond of 1000+ word comments. !!) But… I’m not a guy who’s comfortable with code, and can’t get the plugin to work.

    I’m using Vladimir Prelovac’s Amazing Grace theme. I have no idea of how to find whether or not the comment form has the name attribute “commentform”. (I’ve looked through comment.php but can’t find it.) I inserted the code into the appropriate line, but it doesn’t seem to work.

    aaaarrrggghhhh! I may need counseling after all of this! ;-) Can you help??

    Thanks in advance…

    Kevin

    • 15.1

      Hi Kevin,

      I’m afraid I’m not able to provide custom coding or theme modifications for folks using the plugin, but I hope the instructions above (including the explicit code example from the default theme) can be of some help.

      As a general guide, with regard to the name attribute, if you have a peek at your comments.php file in your theme, you’ll find the form tag in it already has id="commentform", and what it needs is that as well as name="commentform".

      Then it’s just a matter of adding the template tag documented in the instructions on this page (namely, gcll_tweak_textarea), and you’re good to go.

      For general assistance with modifying XHTML in general or WordPress theme files in particular, there are loads of free resources out there as well as plenty of paid help available for folks who would just like to get it done without investing lots of their time.

      All the best,
      Greg

  6. 16

    Greg,

    Thanks for your response. Good news/bad news: I’ve gone back and tried several things… the plugin seems to work ok at present, except the countdown “character counter” is there, but doesn’t count down. (As I type this, your counter is functioning normally.)

    I tried pasting a 900+ word document as a comment, and when I submitted it, the plugin truncated it, per the settings I’d opted for. So it works (I think), but the counter isn’t.

    Any thoughts?

    Thanks for your time and help!

    Kevin

    • 16.1

      Kevin, as I mentioned, I’m not in a position to provide free custom theme modifications for folks using the plugin. However, if you follow the instructions, I’m confident you’ll be able to get things working properly. (I can tell with a quick look at your site that the form tag does not have the required name attribute, and the textarea tag does not have the required tweak.)

      All the best,
      Greg

  7. 17

    [...] last bit brings me to my blog-update related news. I added a new plugin tonight, “Greg’s Comment Length Limiter” which pretty much does exactly what it says. When I’m quickly perusing the spam folder [...]

  8. 18

    I finally got it to work. If you know nothing at all about XHTML, you may struggle a bit. I found this article to be of help: http://is.gd/4wyxX

    • 18.1

      Hi Kevin,

      Hey, that’s excellent — I’m really glad to hear it’s working for you!

      (Beware that the article you mentioned talks about the pre-2.7 way of displaying comments, so if you ever need to modify something using the new code for 2.7 and later, you may want something newer to refer to.)

      Incidentally, your energy bar recipe looks extremely tasty! Yummmm!

      All the best,
      Greg

Page 2 of 2«12

The comment form is currently closed.