WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Greg's Comment Length Limiter

Provides a configurable limit on the length of comments left in the comment form, with a dynamically updated character count displayed for the user.

NOTE: Please do NOT use the WordPress forums to seek support for this plugin. Support for GCLL is handled on our own site.

  1. Unzip the plugin archive
  2. Upload the entire folder gregs-comment-length-limiter to /wp-content/plugins/
  3. Activate the plugin through the 'Plugins' menu in WordPress
  4. Go to Settings -> Comment Length Limiter to configure your preferences
  5. Update your template's comments.php with one or two function calls, as described below

Usage

With just a single line of code -- or none at all -- most themes which support WordPress 2.7 will also support the comment length limit provided by this plugin. (Note that themes must include the wp_footer() call in order for this plugin -- and many others out there -- to work correctly.)

WordPress 3.0 and Themes Using the New Comment Form Function

Under WordPress 3.0 and later, the entire comment form can be generated via a single call to the function comment_form(). If your theme uses the new comment_form, this plugin can automatically tweak the form so comments can be counted. The plugin filters the comment_field default and inserts the countdown box just after the label tag for the comment area. If you'd rather position the countdown box yourself, you can do so by tapping into any of the standard comment form filters and inserting the value returned by gcll_show_limit_box_for_filtering().

If your theme does not use the new 3.0 functionality, please use the instructions in the following section.

WordPress 2.9.2 and Earlier, And 3.0+ Themes Without the New Comment Form Functionality

Preparing your comment form for length limiting is still very straightforward:

  • Add the following function call within the textarea tag for your comment area, preferably wrapped in a conditional that tests whether the function exists: <?php gcll_tweak_textarea(); ?>

For example, here is how the WordPress 2.7 default theme's comment textarea looks after updating the tag to support Greg's Comment Length Limiter plugin:

<p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4" <?php if (function_exists('gcll_tweak_textarea')) gcll_tweak_textarea(); ?>></textarea></p>

Optionally, if you would like to position the countdown box yourself, add the following function call wherever you would like the box to appear within your comment form, again preferably wrapped in a conditional that tests whether the function exists:

<?php gcll_show_limit_box_manually(); ?>

The plugin settings page allows you to specify whether you would like the plugin to place the countdown box automatically, or whether you would prefer to do that yourself. If you specify that the plugin should place the countdown box automatically, that setting will apply even if you also include manual placement code within your theme -- in other words, the plugin is intelligent enough not to attempt to do it twice. So, if you'd like to compare your placement with the default placement, you can flip the manual placement setting on and off and view the results, without repeatedly adding and deleting the call from your theme.

Manual Positioning Via Direct Calls

For styling purposes, manual calls to display the countdown box, using <?php gcll_show_limit_box_manually(); ?> or <?php gcll_show_limit_box_for_filtering(); ?>, can also take one parameter specifying your preferred class for the <span> which encloses the box: <?php gcll_show_limit_box_manually('mypreferredclass'); ?>.

The default <span> class is countdownbox.

Safe Wrapping of Plugin-Dependent Function Calls

I cover safe wrapping of plugin-dependent function calls on the Greg's Plugins FAQ.

Deactivating and Uninstalling

You can deactivate Greg's Comment Length Limiter plugin via the plugins administration page, and your preferences will be saved for the next time you enable it.

However, if you would like to remove the plugin completely, just disable it via the plugins administration page, then select it from the list of recently deactivated plugins and choose "Delete" from the admin menu. This will not only delete the plugin, but it will also run a special routine included with the plugin which will completely remove its preferences from the database.

Requires: 2.7 or higher
Compatible up to: 3.9.2
Last Updated: 2014-4-23
Downloads: 14,079

Ratings

4 stars
4.5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1 100,1,1
100,1,1
100,1,1
100,3,3
100,3,3 100,2,2 100,3,3 100,2,2 100,2,2 100,2,2
100,2,2 100,2,2 0,1,0
50,2,1 67,3,2 100,1,1
0,1,0
100,2,2
0,1,0
100,1,1
0,1,0 100,1,1
0,1,0
100,1,1
0,1,0
100,2,2