Identifying new comments since your last visit

The other day I was reading the discussions taking place in the comments on a relatively interesting blog post. I didn’t want to subscribe to comments via email because I hate littering my inbox with that stuff, so every now and then I’d flip over to that tab in my browser, refresh the page, and read the new comments. This worked ok up to a couple dozen comments. I had to step away for a few hours, and when I came back there was three dozen or so new comments. I couldn’t tell what was new and what wasn’t. So I didn’t read any of them.

Then I realized something I’ve known for a long time and never really paid any attention. Discussion software sucks. There are lots of reasons, and people have tried addressing these problems in a number of ways. And while there are many different types of platforms for discussions – forums, blog comments, Facebook groups, etc. – each with its own set of problems, there’s one problem that’s almost universal: the inability to identify new comments since your last visit.

Naturally I wondered if anyone had created a WordPress plugin that highlights new comments, and a quick search turned up nothing. But I did find a blog post by Natko Hasic that laid out an interesting way to highlight new comments.

I decided to turn his solution in a plugin. Comments Since Last Visit is a simple WordPress plugin that highlights new comments made on posts since a person’s last visit.

Right now it’s very simple and has no options for controlling the color, spacing, or other CSS. It’s better suited for developers or tinkerers who’d want to modify it to their own liking. Check it out and let me know what you think. And if you know a better or more interesting way to do this, please share.

9 thoughts on “Identifying new comments since your last visit

  1. Have been working on some modifications, in response to some user feedback and to my own user experience with this and similar functions.

    Using your code as the starting point, I’ve implemented a session marker – in the form of two addition cookies, one storing current session time, the other storing a “fallback” time that will used on the next visit to replace the last-session/visit after a return visit/next session. The objective was to make it possible for a user to return to the site/post see a bunch of new comments, and freely reply and browse around without losing the old “since last visit” markings until the end of the current session. The other main change was removing since-last-visit highlighting for first-ever-visits, which I always found a bit confusing and also design-negative in the past.

    Also added a function and shortcode for displaying the last-visit time at the top of the comment thread.

    After I’ve worked a few more things out, I’ll want to add some admin options and maybe a function for displaying new comments only, which users also seem to want.

    Of course, many sites using one or another Ajaxified comments system have their own special new comments functions, but I don’t care for them much. If they make sense, they make sense for very busy sites whose comment sections are closer to chat rooms than to places where more serious and thoughtful discussion is meant to take place.

    If you’re still working on this plug-in at all, there are a couple of questions I have regarding the approach you took. If not, thanks much for your work, and I’ll be sure to continue crediting you in future forks or “reloads.”

    • Ah! Good to see you’re still interested! I’ll clean up the code, test a few things, and finish a couple of additions (including the “show only” button mentioned above), and post it on Github next week. I’m aiming to put something together for the WP plug-in repository. In the meantime, you can see the current version in use at http://ordinary-gentlemen.com/ . I’m also using and discussing it at my development blog attached to that site: http://ordinary-gentlemen.com/developing/2015/08/new-new-since-last-visit-commenting/

      • Just an update, since I let my self-imposed deadline slip a bit.

        I’ve been working out the “show only” and also “scroll through new” functions (in jQuery). Am also still gathering strength and handling side-problems before 1) tackling a last set of complicated less-than-perfects on the new session cookies and “what counts as last visit” logic, and 2) setting up an admin options page

        I’d mentioned questions I had for you. For one thing, I’m wonder why you set 50 as the limit for cookie size: Is that based on particular information, or was it just a number out of the air? Since my version sets three cookies, of which two persist until a distant expiration, I wonder if this is something to keep in mind.

        New version being tested here: ordinary-gentlemen.com/developing/2015/08/comments-since-last-visit-reloaded-reloaded-testing-post/

Leave a Reply