Recent Comments

Caveat

Unfortunately, due to ill-health, this plugin has not been developed or supported properly for some years. It works with the latest versions of WordPress (including on this website) but could possibly conflict with any WordPress features added after 2008 — e.g. custom post types — if you use them.

Purpose

This plugin displays a list of the most recent comments to your blog in a highly customisable way.

This is version 2.6.2.1 download latest version. It is compatible with WordPress 1.5–2.6.2.

Please note the new upgrade instructions!

  • 2.6.2.1 allows output to be restricted to one comment per post.
  • 2.6.2.0 supplies a .pot file making internationalisation possible; introduces the {imagealt} output tag and allows {excerpt} to output whole sentences; the content filter and the widget can now take a parameter string; output can be automatically placed after post content without editing theme files.
  • 2.6.1.0 allows the current post to be marked manually where the automatic mechanism fails; when used as a widget the plugin now honours the setting to show nothing when there is no output; and {commenterlink} now applies the appropriate WordPress filter.
  • 2.6.0.1 fixes the option to include attachments and adds a parameter to the {imagesrc} output tag to append a suffix to the image name.
  • 2.5.0.11 has a new option to include posts which are attachments; a new output template tag {authorurl} which points to the archive of the author’s posts; new behaviour for the {php} output tag which can now accept other output tags in the code.
  • 2.5.0.10 fixes several bugs.
  • 2.5.0.9 adds an option to match the current post’s author and extends the options for snippet and excerpt output tags to make the ‘more’ text into a link.
  • 2.5.0.8 adds an option to show posts by status, i.e., published/private/draft/future, changes the {categorynames} and {categorylinks} output tags by applying the ‘single_cat_name’ filter, and fixes a bug in WordPress pre-2.2 that stopped installation code running on Windows servers.
  • 2.5.0.1 has a new option to only show comments from the current post and improvements to the output tags {commentsnippet} and {commentexcerpt}.
  • 2.5.0 introduces a new output tag {imagesrc}, and adds more parameters to {image}. Fixes bugs with empty categories, excluded posts, and the option to omit current posts.
  • 2.5b25 makes some important changes: the {image} output tag now serves real thumbnails (couple of bug fixes too); output can now be sorted as you choose with sub-headings included; the {date:raw} tag modifier has been added to help the sorting; the ‘trim_before’ option has been replaced with the more logical ‘divider’.
  • 2.5b24 fixes to stop recursive replacement by content filter, {gravatar} to allow for ‘identicon’ etc., to {commenter} to allow trimming, and to remove a warning in safe mode
  • 2.5b23 brings a new option to filter on custom fields and adds proper nesting of braces in {if}.
  • 2.5b22 fixes bugs in several output tags, and introduces two new options: to show only pages and to omit comments by registered users.
  • 2.5b18 fixes a filtering problem and introduces the conditional tag, {if:condition:yes:no}.
  • 2.5b16 fixes a problem with {php}.
  • 2.5b15 more bug fixes and added ‘included posts’ setting.
  • 2.5b14 continuing bug fixes.
  • 2.5b11 has new features and improvements.
  • 2.3.6 restores the widgetiness I managed to remove in 2.3.5!
  • 2.3.5 has been rebuilt to save memory and can match the current post’s tags. It also fixes a bug with categories in WordPress < 2.3.
  • 2.3.4 can be used as a WordPress widget. Also can include or exclude the current post from the output.
  • 2.3.3 beta adds the ability to include as well as exclude categories and authors and is able to find posts by tag.
  • 2.3.2 beta fixes a conflict between tags and categories and grouping bug introduced in 2.3.0.
  • 2.3.1 fixes a stupid bug in category exclusion
  • 2.3.0 is compatible with WP 2.3
  • 2.1.1 fixes a bug when recent_comments() is used more than once on a page

The plugin has an settings page which lets you change how the output is generated and displayed.

Installation Instructions

  1. If upgrading from a previous version, first deactivate the plugin via the Plugins page and delete the plugin folder from your server.
  2. Upload the plugin folder to your /wp-content/plugins/ directory. You will also need to install the Post-Plugin Library.
  3. Go to your admin Plugins page and activate Recent Comments.
  4. Put<!--?php recent_comments(); ?--> at the place in your theme files where you want the list of similar posts to appear. Lorelle on WordPress has a good guide to modifying themes for plugins. If you are using a widget-ready theme the plugin can be placed from the widget admin page.
  5. Use the admin Options|Recent Comments page to set all the available options. Alternatively, the options can be overridden by passing a parameter to the recent_comments template tag.

Usage and Options

The configuration page will help you to set up the plugin to your satisfaction.

If you also install the latest version of Plugin Output Cache the output of this plugin will be automatically cached for efficiency.

168 replies on “Recent Comments”

  1. Richard: I’m afraid the plugins don’t handle private posts but I’ll investigate whether it would take much work to get them doing so.

  2. Thanks for that comment Rob. You maybe wondering why I want to make private posts commentable? It’s in conjunction with the ‘Private Plus plugin that grants any registered/ logged in user the right to view any post marked ‘Private’ So we can mark posts private to creat a ‘members section’ for registered userrs.

    I’ll keep subscribed to this thread in case you see a work around for this. Thanks again… Richard

  3. Is it possible to display ALL site comments in on a dedicated page? Or display all comments from a particular category on a page? Im thinking that if this was possible, we could display in effect a stream of conversations that users could browse and then click to visit in order to continue their own comments. A bit like a forum showing all posts on the forum, in a certain category, or section. Comments and forum conversations are very similar so this might be a useful feature. Any ideas Rob?

    TIA

  4. Richard: One ‘hacky’ way of doing it would be simply to specify a very large number for the number of comments to show (limit). If you get some mileage out of your idea it would be easy enough to add a ‘show all’ option. I’ll be interested to see how it works out.

  5. Ok, her’s my starter.

    1- Created a new page template called comments-full.php
    2- inserted <?php recent_comments(); ?> in the page
    3- created a new page called comments using that new template
    4- All comments are show in the page as desired.

    TODO
    I am already using the comments in the side panel and using some restricted options, such as limiting the comments to 5 items only. In the comments-full.php page, I want to specify a new set of variable that won’t affect my sidebar comments settings. Such as adding {author} {commenter} {categorynames} {date} {excerpt} {gravatar}

    How would I do that?

  6. Richard: You can specify a parameter string, e.g.,

    <?php recent_comments('limit=9999&output_template={author} {commenter} {categorynames} {date} {excerpt} {gravatar}'); ?>

  7. I’ve got this error

    Fatal error: Call to undefined function where_just_post() in /home/ismart/public_html/howtodownloadfiles.com/wp-content/plugins/recent-comments-plugin/recent-comments.php on line 99

  8. Just did the lastest up not 1 hr ago and now get this error when trying to loginto the admin panel

    Fatal error: Call to undefined function ppl_plugin_basename() in /home/bananabe/public_html/wp-content/plugins/recent-comments-plugin/recent-comments-admin.php on line 244

  9. line 244 of the code has the error in it on the latest update, changed it to the previous version to read:
    add_action(‘activate_’.str_replace(‘-admin’, ”, plugin_basename(__FILE__)), ‘recent_comments_install’);

    and it worked

  10. chris: Are you sure you got the latest version (2.5.0.7) of the Post-Plugin Library? It provides the function ppl_plugin_basename which handles earlier versions of WP having problems with windows servers.

  11. I just did the upgrade to 2.5.0.7 on another wp 2.5.1 install and got this:

    Plugin failed to reactivate due to a fatal error.

    Fatal error: Call to undefined function ppl_plugin_basename() in /home/bananabe/public_html/chrisneaves/wp-content/plugins/recent-comments-plugin/recent-comments-admin.php on line 244

    And of course taking out the ppl_ alllowed the plugin to work again and no fatal error.

    But from experiments here it all goes mad if the post plugin library is not installed first, as happened when you use the plugin central plugin to upload the updates

  12. If you had the misfortune to download version 2.5.0.7 you may run into problems when you try to update to a newer version. I managed to introduce a circular dependence between this plugin and the Post-Plugin Library which means trying to update either from the admin plugins page will cause an error. Instead you need to delete the 2.5.0.7 version from the server (Post-Plugin LIbrary too) and upload the newer one and the problem should be solved. I apologise for any worry or inconvenience.

  13. I am working on a site on wp v2.3.2. When I install them I cant acitvate the post-plugin librairy without getting a fatal error. and when I install and activate recent comments all the admin screens return blank. If I delete these two plugins, everything returns to normal. Any thoughts on what I should try.

  14. steve: Are you sure you have the latest (2.5.0.8) versions? 2.5.0.7 was causing some issues.

    Can you let me know some details about your server setup? Windows/Linux, versions of PHP, MySQL, etc.?

    Meanwhile I’ll try installing here on a clean WP2.3.2 and see what happens.

  15. hello Rob, I’d like to give you a heads up re what seems to be a recurring problem with my recent update to 2.5.0.9 for both recent comments and post plugin.

    Directly after upgrading, all my recent comments on the index page disappear. My settings are:

    posts to show: 10
    posts to skip: 0
    show password protected: yes
    show static pages: both pages and posts
    display posts that are: (all no)
    ignore posts: (no date)
    omit current post: no
    show just current post: no
    match the current posts category: no
    match the current posts tags: no
    match the current posts author: no
    type of comment to show: all kinds of comments
    omit comments by author: no
    omit comments by registered users: no

    I have two 2.5.1 wp blogs. On the 1st blog, all comments disappeared, but suddenly reappeared after a few days.

    On this 2nd blog, I just updated all plugins and again, all comments disappeared. I’m waiting for them to reappear again, but I’ve decided to write you about it as well.

    Does it cache somewhere first? I’ve tried uploading, deleting, uploading again, logging in and out, to no avail. Any help you can extend would be great.

    many thanks!
    Gary

  16. gary: The problem is that your setting tell the plugin not to display anything! You need to change ‘display posts that are’ to be yes for at least published.

    If you when you update the plugins you make sure they get deactivated and reactivated any new default values get added–this one would have set to display published posts.

    Good luck!

  17. Hi Rob, thanks for getting back, not sure to get what you mean. If you refer to homepage widgets, the sidebar widgets are as follows :

    1- Sensitive tag cloud
    2- Categories
    3- Recent comments (yours)
    4- Links

    Also, my permalink structure is :
    /%postname%.html

  18. Rob : update : got the same issue if I use {link} instead of {commentlink} in the output setup. I also tried upgrading to the latest version of the library and the plugin, it didn’t fix the problem.

  19. kaneesha: If I understand you correctly then I think you can do what you ask but it’s success will depend on whether your categories are ‘flat’ or ‘hierarchical’ or ‘tag-like’.

    I suggest that you use the sorting facility on the plugin’s output settings screen. Sort the comments by {categoryid} and choose something like {categorylinks} as the group template. If you want to exclude some categories you can do that from the filter screen. Play around and see if you can get the output you want.

  20. Marc: I was meaning whether your homepage showed the usual list of recent posts or was a static page.

    I was wondering if the problem is with your permalink structure but that still doesn’t explain why the permalink for a comment should be getting the permalink for the homepage…

    The {commentlink} tag doesn’t really do much beyond calling WordPress’ get_permalink() function to do all the work. So either there is something screwy with the permalinks or for some reason the plugin isn’t picking up the correct post IDs. But if it were getting bad IDs I would expect the {commentexcerpt} to be bad also.

    I am puzzled.

  21. Rob: thanks for the details, will let you know if I manage to fix this. (yes, the homepage shows the usual list of recent posts).

  22. Hi Rob,

    Your plugins are excellently thought out and written. I just started using your set of plugins and am impressed by the quality of the code.

  23. Lise: Thank you for your translation/tutorial!

    I am sending you a .pot file by email for you to have a look at. I am not sure my code is properly set up for translation so maybe you could give me your opinion?

  24. Just had a pretty spectacular bug which looks to have been the work of Recent Comments, I thought I should give you a heads up. I can’t provide any debug info as I had to get it off the server.

    Had been in use for a long time without issue, but for no apparent reason (and in response to no user action) for the last couple of days it would start some kind of crazed mysql DB access routine which lasted several hours each day, overloading the server with huge numbers of manipulations of the taxonomy and relationships tables for all the posts.

    During this period the server would slow to a crawl under what looked to have been dozens of queries a second. The entire DB is only a few mb so I think it must have got looped into something, as it could have done anything to the entire DB a thousand times over with all that CPU time?

    I may have time to test and reinstall later, so I will try to provide any details then. Was a bit urgent with the server in meltdown.

  25. James: That sounds like an important issue to get to the bottom of!!! Can you let me have whatever evidence you have that makes you think Recent Comments was the culprit? I’d like to find out what’s going on and fix any possible problems.

  26. Does this plug in work on its own or only for blog powered sites? I want my visitors to be able to leave comments about particular articles on my site. I’m currently using a forum wwww.pristinepakistan.com/mainsite/forum from SMF.

  27. Also, does it work for Joomla type sites. I used Joomla tp create a site but again I want users to be able to leave comments about the articles that can be read by following a link. for example “”Decent Homes”” xx comments, by xx users

  28. I did the trial and error plugin deactivation, and the load only subsided on recent comments going away. Without it on it has not recoccurred. As it was causing havoc on a production site, I’m afraid I didn’t test it too thoroughly. Also, I think only WP itself and RC have any reason to be accessing those tables, of the plugins on there.

    It would persist even when restarting the server, and it was tearing through the entire DB (only 5mb) for hours using all the CPU on the server. Somebody with the hosting company suggested it might be something cronned, given the reoccurence, but it was definitely coming from within WP (using the WP only account), and turning off RC put a quick stop to it. Traffic on the site was only normal (several hundred visits an hour), and it is at any rate WP-Cached.

    As I can’t mess around too much on the site there is a limit to what I can present – my apologies.

    I have changed around the PHP on the server substantially, so I will brave it again when I can watch over it… I’ll report back if it continues or abates.

  29. Wonderful plugin! Just a couple feature requests, if I may: The option to use a default gravatar if the commenter doesn’t have one, and the option to resize gravatars.

    Once again, outstanding work!

  30. Oops…and one more thing (perhaps I haven’t found it yet): When grouping by post, be able to limit the number of comments shown per post. (E.g., 15 comments max, no more than 5 per post.)

  31. Kestrel: The gravatar output template tag already handles the cases you mention. The documentation says:

    {gravatar:size:rating:default} : Displays a globally recognised avatar based on the commenter’s email address. By default, size is 96px. The ‘default’ parameter lets you specify the uri of an image to use when the commenter has no gravatar. Alternatively, you can specify ‘wavatar’, ‘monsterid’, or ‘identicon’ to have an individualised image returned as default.

    I’m afraid your second request — limiting by post — has proved much harder to implement–the query gets quite rococo–and is shelved for the moment.

  32. Thanks Rob 🙂 Actually, I was able to go into the code itself and do the same thing option does. Totally missed the options when I was looking there; all I saw was {gravatar} — my bad!

    I don’t know if it’s any help, but Get Recent Comments plugin lists x comments for n posts; I wasn’t real happy with how it worked in my new theme, which is how I found yours.

    Thanks for the quick response!

  33. Really great plugin!! Thanks

    A feature request:
    I have installed a plugin called KeywordLuv. It lets you enter your name as YourName@YourKeywordsHere and then displays it as

    YourName From YourKeywordsHere with YourKeywordsHere as the main link.

    Now most of my commenters are using this format. However, you can imagine what it looks like in my recent comments widget in the sidebar.

    Will be great if you can incorporate the same in your plugin. Lots of people have started to use the Keyword Luv plugin and will be happy to have this option in your plugin as well. Thanks!

  34. Erum: I will include a call to the right filter in the next release. If you want to make the change right away you will need to edit output_tags.php in the post-plugin-library. The last line of the function otf_commenterlink needs changing from

    return $value;

    to

    return apply_filters('get_comment_author_link', $value);

    After the edit the {commenterlink} output tag will show a link to the comment author properly filtered.

Comments are closed.