Your Comments Plugin

One time on flickr I was looking at the “Photos you’ve commented on” feature, and thought, wouldn’t it be great if we had that on our blogs? Then we could follow the discussions we’re taken part in.

If you are not familiar with this feature, it’s a list of a number of photos you’ve commented on with newer responses shown too. I took a little screenshot for clarification purposes.

For each photo the title is shown – for example Worst ad ever! – along with the total number of comments and the number of comments since your latest. Unless you’re over the threshold the first comment shown is your own, followed by the newer comments.

My idea was to include it in the sidebar, but including the comment text as flickr does would be a little to extreme. I simply include the name of the author of the newer comments.

I’ve included a limit, if there are more new comments than this limit, only the newest within the limit are shown (with an elipsis in front). By default the limit is 6 comments. The limit on the number of posts to show comments from is 5 by default. These are the same default limits as Brian Meidell’s Latest Comments plugin. In general the resulting html has taken a page from Brian’s plugin. This plugin also incooperates the comment temperature feature as seen in Brian’s Latest Comments. The implementation of that feature is courtesy of Brian.

Plugin will be available shortly, just have to clean up a bit and document it.

*Update:* There is a bug in the plugin where the listing of the comments is borked. I thought I had the SQL figured out, but I guess I’ll have to revisit it. I’ve taken the link down until I’ve fixed it.

Update: Error has been fixed, get it here: Your Comments and place the extracted php file in the plugins folder of your wordpress blog.

System Requirements

  • Wordpress 1.5 or later
  • PHP 4.3.0 or later

Changelog

1.1b1 First version that wasn’t totally broken.
1.1b2 Corrected how the user was shown and included some options to control what was shown.

Documentation

Add the function teb_your_comments() to your template where you want the plugin result to be shown. The function uses url type arguments.

Tag parameters

post_limit
(number) Sets the maximum number of posts for which to show comments. Default is 5.

new_cmnt_limit
(number) Sets the maximum number of new comments to show for each post. If the number of new comments exceeds this threshold only the newest comments within this number are shown. The behavior of what else is shown is dependent on the always_show_user and show_cut parameters. Default is 6.

hide_pingbacks_and_trackbacks
(boolean) Does what it says.

  • 1 (true – default)
  • 0 (false)

user_class
(string) The class for the link to the newest comment by user. Default is ‘user’.

user_name
(string) The name to use for the user, can be any text, a percent sign is substituted with the name of the user as set by them when they wrote the comment. Default is ‘%’.

always_show_user
(boolean) Selects whether the user should be shown on every post where he’s commented, or only those that have more new comments than the new_cmnt_limit.

  • 1 (true – default)
  • 0 (false)

show_cut
(boolean) Show an elipsis before the user for posts where the number of new comments exceed new_cmnt_limit. The elipsis is a link to the first comment after the latest user comment.

  • 1 (true – default)
  • 0 (false)

prefix
(string) Text to insert before each post, for example an HTML tag. Default is ‘<li>’.

postfix
(string) Text to insert after each post and its comments, for example an HTML tag. Default is ‘</li&gt’;.

stats_class
(string) The class for the span element where the total and new number of comments are shown. Default is ‘stats’.

fade_old
(boolean) Should we use the comment temperature feature?

  • 1 (true – default)
  • 0 (false)

range_in_days
(number) The number of days it takes for a comment to fade from the newest color to the oldest color. Default is 10 days.

new_col
(string) The color of a completely new post in RGB hex format. The default is a dark gray, #444444.

old_col
(string) The color of a post that is as old or older than the number of days given by the “range in days” argument, same format as new_col. Default is light gray, #cccccc.

Tags: , ,

14 Responses to “Your Comments Plugin”

  1. Chris says:

    That is très chic.

  2. Jonas Rabbe says:

    And it’s out now.

  3. Joen says:

    Wow that’s really neat!

    I’ll have to hold it up and rotate it in front of the light, and see how I want to use it. But this is definitely a nice plugin. Thanks a lot!

  4. Jonas Rabbe says:

    Make sure you note how it twinkles in the light, that’s part of what makes it cool. That and the fact that it actually does what it’s supposed to now (as opposed to the version I released earlier).

  5. […] My good friend Jonas has written a new Wordpress “Recent Comments” type plugin, with a twist. Your Comments presents the latest comments to weblog posts, from your perspective. Incidentally, this is very close to what I was asking for in my recent article on keeping old stuff fresh. I’m going to try out the plugin, but with a different design. […]

  6. khaled says:

    Definitely very cool plugin, must give that a try actually. Good work Jonas.

  7. Ka-Meng says:

    Great concept Jonas. Gonna try this out! Thanks!

  8. matthew says:

    Nice, great idea. Works well.

  9. […] New plugin shows your comments relative to any new comments on that post. No responses to ‘Your Comments Plugin’. RSS feed for comments and Trackback URI. […]

  10. I love the functionality, but I can’t for the life of me get it to work properly. If I’m logged in, it says ‘not logged in’, and in my quick localhost test, I posted a comment with a non-registered user, and it didn’t show the comments I posted after that.

    Is it working perfectly for you?

  11. Jonas Rabbe says:

    I’ve seen the ‘not logged in’ on Joen’s main page. However, if I then goto an entry and back to the main page, then it works fine. I have a feeling it’s a cookie issue, but I’ll be trying to figure out exactly what.

    Other than that it’s working pretty well for me.

  12. kus says:

    yup, i get ‘ not logged in ‘ flag on my page , hoo and on this page.

  13. kus says:

    yeah , cool .. after write (a) comments here , now I can see the real fuction of this plugins.

    nice , thanks for this plugins.

  14. Alexander says:

    Cool script, thanks!!

Leave a Reply