Recent Comment Plugin

February 24, 2007

I have been using Raoul’s Simple Recent Comments plugin with some minor mods to it.   I tried to improve on it and asked question in forum, didn’t get anywhere at the end.

Raoul’s plugin isn’t simple and with fairly complicated sql query using clauses like “LEFT OUTER JOIN”, “WHERE”, “ORDER BY” and “LIMIT” etc.

Now I have rewritten it from the ground up getting hints from WordPress’s \wp-admin\index.php file.    This is the file first loaded when you logged in.    I can see recent comments listed there.

My plugin is now very simple with 2 reusable functions written, one to truncate the comment, using PHP’s explode and implode, and the other one to calculate time different between when comment was posted and “now”.    I can find good use of these functions elsewhere.    Raoul’s plugin uses “SUBSTRING(comment_content,1,$src_length) AS com_excerpt” which is far too hard for beginner like me.

On the sidebar I have put them side-by-side for a test.    My [tag]plugin[/tag] is named [tag]ezComments[/tag].

PS: there is an issue on the time different my time zone here and where the server is located.    I could manually adjust to this but there should be a better way I guess.

One Response to “Recent Comment Plugin”

  1. stanley Says:

    this is a test comment


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: