As seen on Webfroot and this site, now in WordPress Plugin form!
Current Version: 1.3
What it does
Creates a list of posts with comments that haven’t been read by the user since their last visit/session. Uses cookies to track users last visit – no database required!
How it works:
Users are issued cookies which are used to track last visit. If this is their first visit, all comments in the last 14 days are unread. The plugin generates a list of unread comments. It keeps track of the user’s read posts for the session, removing them from the list as the user goes. Each page load updates the last unread timestamp cookie. Users can also mark all comments as read.
Installation:
Either:
- RECOMMENDED: Install WordPress Plugin Manager then use the One Click Install for Smart Unread Comments. This will also make it easier to install other plugins and upgrade them in the future.
- OR: Download Smart Unread Comments, extract and upload
wbft-smart-unread-comments.php
to yourwp-content/plugins
directory. Log-in to your WP admin panel, go to the Plugins tab and activate the Smart Unread Comments plugin.
Implementation:
In your template, add this code.
<ul><?php echo get_smart_unread_comments(); ?></ul>
get_smart_unread_comments() also takes options:
- $limit
Default: 5.
Maximum posts with unread comments to display. - $output_when_no_unread_comments
Default: TRUE
If true, when there are no unread comments, it will output a<li class="wbftSUC_NoComments" >
item containing $no_unread_comments_text - $output_when_more_unread_comments_than_limit
Default: TRUE
If true, when there are more than $limit unread comments, it will output a<li class="wbftSUC_MoreComments" >
item containing $more_unread_comments_text - $mark_comments_as_read_text
Default: “Mark all comments as read”
String used in link Mark all Comments as Read link. - $no_unread_comments_text
Default: “There are no unread comments”
String used when there no unread comments and $output_when_no_unread_comments is TRUE - $more_unread_comments_text
Default: “There are %d more unread comments…”
String used when there are more than $limit unread comments and $output_when_more_unread_comments_than_limit is TRUE
%d will be replaced with a count of how many more comments there are to view.
Documentation:
You’re looking at it!
CSS Classes output:
Remember, CSS classes are CASE SENSITIVE.
class='wbftSUC_MarkAsRead'
Used on the Mark Comments as Unread linkclass='wbftSUC_Recent'
Used on comments less than 6 hours oldclass='wbftSUC_MoreComments'
Used on More Unread Comments list itemclass='wbftSUC_NoComments'
Used on No Unread Comments list item
Version History:
1.3: Now uses permalink structure, and sets cookies to your blog’s path. $limit defaults to 5 (not 10), and $output_when_more_unread_comments_than_limit defaults to TRUE.
1.21: Fixed broken (x)html validation due to stray
1.2: Fixed major bug with post title links.
1.11: Tables are now pulled from WP variables.
1.1: Initial Public Release.
Known Issues:
Comments on Pages (as opposed to posts) turn up on the list, but visiting the Page doesn’t mark those comments as unread.
Credit:
- Chris Beaven (aka SmileyChris) for writing the original code seen on Webfroot, and helping with updating it.
- Dan aka Mufasa and Tom for isolating the code from Chris’s Webfroot code magic and encouraging Me to write it.
- Brett Taylor (Me! aka Glutnix) for turning it into a WP plugin and making the number of unread comments on each post link to the oldest unread comment rather than the newest unread comment.
Bugs and Suggestions
Any bugs or suggestions, please email me – email link in the sidebar (RSS readers: drop by the site ).
[…] Visit […]
[…] pourquoi je le met entre guillemette, car je trouve le terme francophone assez laid merci) nommé Smart Unread Comments, qui permet à l’aide de cookie de voir les commentaires non lus. Cela est spécifique à […]
[…] Smart Unread Comments […]
[…] Smart Unread Comments: Permite, mediante el uso de cookies, mostrar al usuario una lista de los comentarios escritos desde su última visita. […]
[…] came across this last night and thought it was definitely worth sharing with you […]
WordPress: 2.3.3
MySQL: 5.0.45-community-nt
PHP: 4.4.7
Server: Microsoft-IIS/6.0
Plugin works fine for me. I’m curious to know how you’re using class/styling. The spacing between the line items is too much for my design, and the little li bullets are missing. Anyway I can adjust that for a better fit?
[…] Smart Unread Comments: Permite, mediante el uso de cookies, mostrar al usuario una lista de los comentarios escritos desde su última visita. […]
[…] Smart Unread Comments: Permite, mediante el uso de cookies, mostrar al usuario una lista de los comentarios escritos desde su última visita. […]
WordPress 3.0 seems to have killed this plugin. Any chance you can take a look at it and, hopefully, it will just need a small fix? 😀
Could you update this to work with WP 3.0?
Any word on if this plugin will work with 3.0.4?
It continually says “No New Comments”.
Was working fine before upgrade.
Found a fix to this plugin.. Now works in 3.0 +
http://lonelycloud.wordpress.com/2010/10/29/worpdress-plugin-smart-unread-comments-reloaded/