Show Pending Comments Count

Author:Scott Reilly
Version:1.2.2
Last update:2011-06-28
Compatibility:WP 2.6 – 3.3.1
Comments:go here
Download:[ zip ]
Description:

Display the pending comments count next to the approved comments count in the admin listing of posts.

Extended Description

Display the pending comments count next to the approved comments count in the admin listing of posts.

By default, in the admin listing of posts, each post has its count of approved comments displayed with a word bubble background. If you hover over a comment count, the tooltip hover text indicates the number of pending comments. This plugin utilizes JavaScript to change the post listings so that the pending comments count is displayed next to the approved comments count inside the same word bubble (though with a separator).

The pending comments count will appear next to post comment counts in:

  • The “Edit Posts” listing of posts
  • The “Edit Pages” listing of pages
  • The “Edit Comments” listing of comments

This plugin will only function for users in the admin who have JavaScript enabled.

Links: Plugin Homepage | Plugin Directory Page | Author Homepage

Find out more at the plugin’s WordPress Plugin Repository page.

Screenshots

Click to see full-size image.

  • show-pending-comments-count screenshot 1

    A screenshot of the ‘Edit Posts’ admin page with the plugin active, showing a post without pending comments and one with pending comments.


Installation

  1. Unzip show-pending-comments-count.zip inside the /wp-content/plugins/ directory for your site (or install via the built-in WordPress plugin installer)
  2. Activate the plugin through the ‘Plugins’ admin menu in WordPress

Filters

The plugin is further customizable via two filters. Typically, these customizations would be put into your active theme’s functions.php file, or used by another plugin.

c2c_show_pending_comments_count_column_width

The ‘c2c_show_pending_comments_count_column_width’ filter allows you to customize the column width used for the comment column when pending comments are also being displayed. The WP default is “4em”, which is not sufficient to display a possible 3 digits for approved comments in addition to a possible 2 digits in pending comments. The default defined by the plugin is “5em” which should handle most cases sufficiently. Use the filter if you want to change the width.

Arguments:

  • $comment_column_width (string): The width of the comment column. Default is “5em”. Express as a width measurement recognized by CSS.

Example:

<?php add_filter( 'c2c_show_pending_comments_count_column_width', 'my_c2c_show_pending_comments_count_column_width' );
// Make it even wider
function my_c2c_show_pending_comments_count_column_width( $comment_column_width ) {
    return '6em';
} ?>

c2c_show_pending_comments_count_separator

The ‘c2c_show_pending_comments_count_separator’ filter allows you to specify the character used as the separator between the count of approved comments and the count of pending comments. By default this is ‘ • ‘ (a bullet, with space on either side).

Arguments:

  • $separator (string): The character or string to be used as the separator. By default this is ‘ • ‘ (note space of either side).
<?php add_filter( 'c2c_show_pending_comments_count_separator', 'my_c2c_show_pending_comments_count_separator' );
// Make it even wider
function my_c2c_show_pending_comments_count_separator( $separator ) {
    return ' | ';
} ?>

Release Log

1.2.2

  • Add version() to return plugin version
  • Note compatibility through WP 3.3+
  • Add link to plugin directory page to readme.txt
  • Update copyright date (2012)

1.2.1

  • Note compatibility through WP 3.2+
  • Minor code formatting changes (spacing)
  • Fix plugin homepage and author links in description in readme.txt

1.2

  • Add filter ‘c2c_show_pending_comments_count_column_width’ to allow customization of the column width used for the comment column
  • Add filter ‘c2c_show_pending_comments_count_separator’ to allow customization of the character used as the separator between comments and pending comments
  • Switch from object instantiation to direct class invocation
  • Explicitly declare all functions public static and class variables private static
  • Add Filters section to readme.txt
  • Note compatibility through WP 3.1+
  • Update copyright date (2011)

1.1

  • Don’t even define class if not in the admin
  • Rename class from ‘ShowPendingCommentsCount’ to ‘c2c_ShowPendingCommentsCount’
  • Output JS via ‘admin_print_footer_scripts’ hook rather than ‘admin_footer’
  • Assign object instance to global variable, $c2c_show_pending_comments_count, to allow for external manipulation
  • Instantiate object within primary if(!class_exists()) check (at end)
  • Note compatibility with WP 3.0+
  • Minor code reformatting (spacing)
  • Remove documentation and instructions from top of plugin file (all of that and more are contained in readme.txt)
  • Add Upgrade Notice section to readme.txt
  • Remove trailing whitespace

1.0.1

  • Add PHPDoc documentation
  • Note compatibility with WP 2.9+
  • Update copyright date

1.0

  • Initial release

Copyright & Disclaimer

Copyright © 2009-2011 by Scott Reilly (aka coffee2code)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.