David Coveney

Live Threaded Commenting on WP

At Interconnect IT / Spectacu.la my colleague James has developed a new version of the popular Spectacu.la Threaded Comments plugin.  It’s not yet in release form, but you can grab it from the WordPress.org repository via svn if you know how at http://svn.wp-plugins.org/spectacula-threaded-comments/trunk/

I’m bringing it up here because I’ve decided to trial the plugin out here on my own site.  It was designed to work in conjunction with a webinars project, allowing visitors to have an active discussion, in real time, on a WordPress site.  It can be dropped into almost any theme, and adds nicely to the standard WP comments functionality.

Threaded comments are a powerful way to turn your WordPress site into a mini discussion forum.  Adding live commenting can now turn it into a chatroom full of ajaxey goodness.

Try it out below, if you like….

Comments

Posted: 12 July, 2010 at 12:10 PM

Dave says:

So, basically, you just comment away down here, click ‘Post your comment’ and you’re off….

Reply

Posted: 12 July, 2010 at 12:11 PM

Dave says:

Would love to know what you think… I think there’s a couple of things to sort out still before this turns into a full release.

Reply

Posted: 12 July, 2010 at 12:13 PM

Rob says:

Nifty!

Posted: 12 July, 2010 at 3:48 PM

Adrian McEwen says:

A textarea.focus() would be nice when you click reply, so I wouldn’t have to click inside the text area to write my comment and could just start typing… :-)

Posted: 12 July, 2010 at 4:35 PM

Dave says:

It should do that… will check after the next commit, however, before bothering James with it! I know he has a long list on his notepad of things to polish off.

Posted: 12 July, 2010 at 12:16 PM

ramtops says:

Testing, testing, 1-2-3

Reply

Posted: 12 July, 2010 at 3:50 PM

Remkus says:

Off? You’re telling me I’m off? The nerve..

Reply

Posted: 12 July, 2010 at 3:54 PM

Dave says:

:-)

Posted: 12 July, 2010 at 4:10 PM

Remkus says:

appearing now, coolio :)

Posted: 17 July, 2010 at 4:10 PM

SimonW says:

Ahem. Testing.

Posted: 17 July, 2010 at 5:00 PM

Dave says:

Hello down there :-)

Posted: 4 September, 2010 at 6:21 AM

John says:

Hi.. I’ve tried installing this plugin on my blog, which is using the third-style theme and there’s always an error saying “Warning: Cannot modify header blah blah!”.
How can it happen?

Posted: 12 July, 2010 at 12:12 PM

Donncha O Caoimh says:

Does it impact performance much? I found that using P2 on my main blog killed the server as there were dozens (or hundreds?) of clients making dynamic requests for comments all the time. It got worse with time as users left their browsers open in the background :(

Reply

Posted: 12 July, 2010 at 12:15 PM

Dave says:

It’s been coded differently to P2 in order to try and keep performance reasonable. But tomorrow we have a client using the plugin on a webinar with around 400 attendees, which should be an interesting test!

Reply

Posted: 12 July, 2010 at 12:31 PM

Andrea_R says:

Really? We’ve been using it locally and doing some tweaks.

Reply

Posted: 12 July, 2010 at 12:15 PM

Simon Dickson says:

Very curious to know how you’ve done this, Dave. We’ve done a ‘live commentary’ app for a client, based on WP comments entered and viewed with ajax – but the toughest part, by far, was working out how to handle the server load… which would (presumably?) be beyond the scope of a WP plugin.

Reply

Posted: 12 July, 2010 at 12:17 PM

Dave says:

Simon – there’s an option to set the polling frequency. The default is 30s, with a 10s possible. It could be made shorter, but you really do have to be careful.

Reply

Posted: 12 July, 2010 at 12:30 PM

Simon Dickson says:

Donncha’s point certainly echoes the experience we had. We got it to work in the end, but had to do some serious reconfiguration at server level.

It’ll be interesting to see how people react to a 30 second delay. Instinctively that feels too long to me: you’re competing with people’s prior experience of instant messaging, so (a potential) 30 seconds could feel like a lifetime in comparison. In my mind, it has to be as close to zero as your server can possibly bear.

Posted: 12 July, 2010 at 3:35 PM

Dave says:

Simon, we use memory tables for handling what is in essence a cache of what’s happening. Keeps performance up. We’ll find out tomorrow when a site gets 400 concurrent users :-/

Posted: 12 July, 2010 at 12:27 PM

Dave says:

Worth noting that server load at the moment seems fine ;-) Need more commenters and viewers on here!

Reply

Posted: 12 July, 2010 at 12:28 PM

Andrea_R says:

Hmmm, I could comment repeatedly and leave my window open. ;)

You know, to help… :D

Posted: 12 July, 2010 at 12:31 PM

Donncha says:

I’ll leave this window open :)

I think something like this will need to have the updates cached. I’m sure there won’t be any updates 90% of the time and it would be a simple matter to cache it in a file and clear the cache file when a comment is made or deleted.

Works a treat though!

Posted: 12 July, 2010 at 12:19 PM

Dave says:

One thing worth noting is that until a comment is approved, others won’t see it.

However, there are a number of ways in which you could make that smoother – you could have subscribers log in and allow them to comment freely, for example, or do as I do and allow pre-approved commenters to comment as they wish.

Reply

Posted: 12 July, 2010 at 12:28 PM

Dave says:

This is me trying to sneak a comment in from a different source to check what browser back buttons do to it…

Reply

Posted: 12 July, 2010 at 12:29 PM

Andrea_R says:

Ooooo this is fancy schmancy…

Reply

Posted: 12 July, 2010 at 12:30 PM

Dave says:

Curiously I’m not seeing the auto-updates myself at the moment, but that was having gone ‘back’ to the page. Hmmmm….

Posted: 12 July, 2010 at 12:35 PM

Andrea_R says:

I was just about to ask if it had auto-updates. I had to refresh to see if anyone relied.

Posted: 12 July, 2010 at 12:37 PM

Dave says:

It does – it just doesn’t seem to be working here! Might be an interaction with something else, of course. I know it works fine on another install. OK, back to the testing!

Posted: 12 July, 2010 at 12:37 PM

Dave says:

Hmmmm – not sure what’s happening, just tried deactivating caching to see what’s going on here. But there really should be fresh comments popping in. Can others see them?

Posted: 12 July, 2010 at 2:43 PM

Donncha says:

Yup, haven’t seen any of the new comments either! Can you see the requests go in for updates?

Posted: 12 July, 2010 at 3:37 PM

Dave says:

We discovered a problem with the code for creating the memory table. Works in standard installations, but failed on my old site where a long line of plugins and a not terribly clever installation five years ago have all left their mark! I really must get around to a ‘reboot’ of this site – probably on my more ‘grown-up’ domain…

Posted: 12 July, 2010 at 12:41 PM

Dave says:

Heh – I think the theme’s own js might be interfering. How ironic… let’s just try something. BRB.

Reply

Posted: 12 July, 2010 at 12:42 PM

Dave says:

Testing testing…

Reply

Posted: 12 July, 2010 at 12:45 PM

SimonW says:

So, football is over.

Reply

Posted: 12 July, 2010 at 12:48 PM

Dave says:

Darn it – the live commenting isn’t working on this site, but is fine on another – suggests an issue with a plugin. Thanks everyone for the feedback and help so far!

Reply

Posted: 12 July, 2010 at 1:03 PM

Kevin Peyton says:

Nice work Dave – leaving the window open

Reply

Posted: 12 July, 2010 at 1:24 PM

Dave says:

Thanks…

Reply

Posted: 12 July, 2010 at 3:12 PM

Dave says:

Now it should work – memory table wasn’t being created…

Reply

Posted: 12 July, 2010 at 3:37 PM

Don McAllister says:

Seemed to take an age for the page to load in safari on my Mac?

Reply

Posted: 12 July, 2010 at 3:39 PM

Dave says:

Hey Don – thanks for dropping by. Should take no more than around a second to load… will look into it…

Reply

Posted: 12 July, 2010 at 3:45 PM

David on another account says:

Interesting thing about moderation….

Reply

Posted: 12 July, 2010 at 3:39 PM

Don McAllister says:

Boo hoo – Dave deleted my comment – I hope that was due to testing and nothing personal – oh! It’s there now. I definitely saw a message saying comment deleted

Reply

Posted: 12 July, 2010 at 3:39 PM

Dave says:

Are you sure it wasn’t just awaiting moderation?

Reply

Posted: 12 July, 2010 at 3:39 PM

Adrian McEwen says:

Ah, just as I’m starting to type this comment it updates with a reply, and then another before I’ve finished typing it. Nice

Reply

Posted: 12 July, 2010 at 3:40 PM

Dave says:

I might have to set the refresh to be a little slower if things get busy… but does seem to be working well at last…

Reply

Posted: 12 July, 2010 at 3:41 PM

Adrian McEwen says:

Is there any way to notice when comments arrive in reply to an earlier comment? I mean, it’s easy to spot new comments coming in at the bottom here, but hard to see if there are new replies once the threading starts to kick in…

Guess I just want it to work as nicely as usenet did back in the day ;-)

Reply

Posted: 12 July, 2010 at 3:42 PM

Dave says:

I’m wondering whether highlighting new comments with a slow fade might help? If you scroll up you’ll see them in pink, say?

Reply

Posted: 12 July, 2010 at 3:43 PM

Adrian McEwen says:

Maybe. The problem is that once they’re off screen I’m not even going to notice that. Not sure there’s a solution really :-s

Posted: 12 July, 2010 at 3:48 PM

Ross says:

Maybe some sort of growl like notification might help if you are interested in previous off-screen comments? Maybe something like … http://projects.zoulcreations.com/jquery/growl/ – although that would get cluttered very quickly

Posted: 12 July, 2010 at 3:51 PM

Dave says:

There’s always a solution! We’ll come up with something, for sure :o)

Posted: 12 July, 2010 at 3:59 PM

Adrian McEwen says:

An NNTP gateway? ;-) (I did consider building such a beast many years ago when I was first getting into blogging…)

Posted: 12 July, 2010 at 4:01 PM

Dave says:

Well, it’s an open source project Adrian – you could always code that up for it ;-)

Posted: 12 July, 2010 at 3:42 PM

Glen says:

Is this going to support collapsing or at least some way to limit it to the top ‘n’ posts as on a busy blog this will be mahooooosive.

Also its annoying to type as the text area keeps getting lower……..

Reply

Posted: 12 July, 2010 at 4:00 PM

Dave says:

Collapsing is indeed supported… you can choose how many levels deep to go.

Reply

Posted: 12 July, 2010 at 3:42 PM

Don McAllister says:

It went into moderation mode then definitely said comment deleted before suddenly appearing. I’ve exited the page and reloaded it – worked in less than a second that time and looks like I’ve now got all the CSS styling. The first time it looked a bit rough!

Reply

Posted: 12 July, 2010 at 3:47 PM

Dave says:

Don – Glen – it does indeed show as deleted for a while! We’ll look into that, though it’s worth noting that this is definitely still work in progress beyond the original client specs…

Reply

Posted: 12 July, 2010 at 3:48 PM

Dave says:

In fact, we’ll have a fix to that very soon, James just told me he’s aware of the problem and is fixing it.

Reply

Posted: 12 July, 2010 at 3:48 PM

Michael Atkins says:

OK I’ll help test this – posting a comment & leaving the window open. Hopefully I won’t get any wasps flying in.

Reply

Posted: 12 July, 2010 at 3:49 PM

Ross says:

It tells me my newly posted comment is deleted, but then a refresh makes it re-appear :(

Reply

Posted: 12 July, 2010 at 3:51 PM

Dave says:

Yeah, we’ll fix that – this really is alpha style code :o) Not such a problem for our client site as they set it to approve subscriber comments.

Reply

Posted: 12 July, 2010 at 3:52 PM

Ross says:

Would love to know what’s on the back-end …

Posted: 12 July, 2010 at 3:53 PM

Dave says:

Just follow the link above to the svn repo – you can play with it and inspect the code as much as you like :o)

Posted: 12 July, 2010 at 3:56 PM

Ross says:

Haha, was so interested to see if working I went straight to the comments and didn’t actually read the post.

Oh potential bug, whilst I am typing this, other comments are being posted in-line and my comment box is moving down the page – I’m going to wait and see what happens when/if it gets pushed off the bottom because I took so long writing a long reply and other people posted responses to other comments.

And yes, it does ….

Posted: 12 July, 2010 at 3:51 PM

Mark Wilkinson says:

This could be really useful – hope it works well.

Reply

Posted: 12 July, 2010 at 3:52 PM

Don McAllister says:

No problemo Dave.
Be seeing you!

Reply

Posted: 12 July, 2010 at 3:55 PM

Dave says:

Much appreciated! See you soon.

Reply

Posted: 12 July, 2010 at 4:07 PM

Dave says:

Hello Laurie!

Reply

Posted: 12 July, 2010 at 4:09 PM

Laurie says:

Well hello. Here I am helping to test it woohoo

Reply

Posted: 12 July, 2010 at 4:09 PM

Laurie says:

ah as someone said above, it does say ‘deleted comment’ before it allows it on

Reply

Posted: 12 July, 2010 at 4:16 PM

Laurie says:

what is ‘link’ supposed to do? and what happens if you want to delete a comment you have made?

Reply

Posted: 12 July, 2010 at 4:33 PM

Dave says:

Hi Laurie – there’s no facility to delete your own comments (so you have to be nice!).

Link provides a link directly to the comment – for example, if somebody posts something interesting in a comment (it does happen, sometimes) then it can be easily linked to directly.

Reply

Posted: 13 July, 2010 at 11:31 AM

Dave says:

So – newest comment at the top seems to feel a bit more natural for discussions.

Reply

Posted: 13 July, 2010 at 11:39 AM

Dave says:

Quite a few tweaks now made, including getting the cursor into the reply box. Hope it’s good for you.

Reply

Posted: 13 July, 2010 at 12:26 PM

Jonnya says:

Just dropping by to test – looking great guys and yes, this order is much more natural!

Reply

Posted: 13 July, 2010 at 12:27 PM

Jonnya says:

…and now I’m testing threading

Reply

Posted: 13 July, 2010 at 12:28 PM

Dave says:

Thanks for dropping in Jonnya – I think it’s working really well for us…

Posted: 13 July, 2010 at 12:29 PM

Dave says:

In fact, it had its first real use in a live situation at http://webinars.telecoms.com/webinar/strategies-for-successful-evolution-to-lte/

Posted: 13 July, 2010 at 12:30 PM

Jonnya says:

This is great work – wish I had a chance to properly play with it! Really look forward to implementing this in the future:)

Posted: 13 July, 2010 at 12:28 PM

Jonnya says:

Cool – that all works great, well done guys! Even works on my iPhone (with a bit of screen jump)

Posted: 13 July, 2010 at 12:29 PM

Dave says:

Damn right! Anything with decent js support should support this. And if you don’t have js it does, of course, go back to acting just like ‘normal’ commenting – something P2 doesn’t do, incidentally ;-)

Posted: 13 July, 2010 at 12:32 PM

Dave says:

As you may have noticed, it also supports the WP setting for limiting the depth of comments. You can also choose to ‘roll-up’ comments beyond a certain depth as well.

Thanks for the kind words – and you can already use it if you check out the trunk version from the wp.org repo.

Reply

Have your say