Last week I posted about[ a little wordpress plugin I wrote called FancyCatlist](http://www.andydickinson.net/2009/08/04/fancy-category-list-plugin-for-wordpress/). It made a nice little category menu similar to the kind of thing you would see on [Everyblock](http://www.everyblock.com "EveryBlock"). I wrote it as part of the process of putting together one of the sites I want my students to use next year as part of their practice in online publishing. You can see it in action on the ‘work in progress’ site.

The site is a ‘beatblog’ kind of thing and in searching around for examples of different approaches to this kind of thing I stumbled back upon ‘community news engine’ Newsmixer.

[![Newsmixer.com](https://i2.wp.com/www.andydickinson.net/wp-content/uploads/2009/08/Museum-returning-to-Czech-Village-News-Mixer-500x354.jpg?resize=500%2C354 "Museum returning to Czech Village - News Mixer")](https://i2.wp.com/www.andydickinson.net/wp-content/uploads/2009/08/Museum-returning-to-Czech-Village-News-Mixer.jpg)
Its a nice idea and especially impressive as it was a jschool project which you can find out more about on the site itself. But the bit that caught my eye was the ability to comment on each paragraph of the content (and more as you’ll see if you go and explore)

I liked that idea as it taps in to the ‘One Par. One fact’ discipline of  basic journo writing and turns it in to a kind of microlink activitiy. It also begins to stem ideas off from various parts of an article, not just an article itself. Of course the reverse is that it could abstract all meaning out of the text. But used well, as I think it is here, I think it stands up.

So I think to myself that this would be a nice feature to have on the students publication website. But not, in the first instance,  as a way of the reader leaving feedback but as a way for me to leave feedback. A way that I could comment on each paragraph to give students feedback on what they write. I should point out that as I write this, it’s the policy of the department to keep student publications behind a firewall (I’m not so happy with that but hey ho). So feedback in the open is not a problem.

Finding a micro-comment plugin

I had a look around to see what was out there that would do a similar thing. This included poking around the newsmixer source (which is opensource) to see if it was worth using their framework. But they are using python. Great but my head (and life) is too crammed to learn that. Ryan Mark, one of the developers of newsmixer, has announced that newsmixer is heading the way of an API and there will be a wordpress plugin to tap in to all the neat features. But that seems a way off.

The next thing I did was search for wordpress plugins.  The closest I found was marginalia which looks very nice but doesn’t seem to play well with WordPress 2.8 and even with some nice features didnt look like it would scale back to what I wanted.

So I wrote another plugin.

The Feedback By Paragraph plugin

Feedback by Paragraph is a plugin that does a number of things

  • It hijacks the content of the post, looking for the

    tag and inserts some code that attaches a pop-up box to that paragraph so you can leave comments. It inserts a little bubble with a link to open the box which also displays the number of comments there already. It only does this on the article page (what WP calls a single post as defined by the template single.php). It uses the closing p tag because it’s the easiest one to find as the

    is often full of crap like classes etc and my regex is not really up to that. Using

    also has the advantage of picking up any image captions without breaking the styling class.
  • It saves any paragraph comments with a custom ‘comment type’ so that they can be associated with a paragraph
  • It filters out any paragraph comments from the normal comment display.
  • It only allows you to comment if you are an admin or the post author but anyone can see the comments.
[![Feedback By Paragraph](https://i1.wp.com/www.andydickinson.net/wp-content/uploads/2009/08/FBP.jpg?resize=400%2C600 "FBP")](https://i1.wp.com/www.andydickinson.net/wp-content/uploads/2009/08/FBP.jpg)
Feedback By Paragraph
You can [see it in action  the beatblog site ](http://ukjournalism.co.uk/printbeatblog/2009/06/30/generic-preston-story/)

An issue.

**This is now resolved.

There is a big issue to be aware of with this plugin.  When you submit a comment form with a custom comment_type defined  it isnt processed like all the other form elements. I’m not sure why that is but it takes an ammendement to the one of the core files in wordpress to make it (at least that’s the only way I got it to work). That means a tweak to a file called wp-comments-post.php.

Around line 40 you need to add the line

$comment_type = ( isset($_POST['comment_type']) ) ? trim($_POST['comment_type']) : null;

And around line 62 you need to change

$comment_type = '';


//$comment_type = '';

I know, not ideal. I’m sure there is a better way to do this which involves hooks and filters and all that. Please if anyone has even half an idea how this might be done I’d love to hear. But I have yet to find it(or understand it).

How do I use it?

You can download the plugin to try.

What next

There is plenty of flexibility in this plugin and an options page wouldn’t go a miss. I’ll be looking at setting it up so that you have more control over who sees what and perhaps look at setting a template for the comments form so that it isnt hidden in the plugin code. But for now, given that my sites are behind a fire wall it seems to work for me.

Let me know if you download and try the thing. Oh, and don’t forget that tweak of the core file.

NOTE: First bug fix! This version makes the call to the database for the comments using the generic form rather than being hard coded to a particular table. Sorry!

**Visit the feedbackBP plugin page

[![Enhanced by Zemanta](https://i0.wp.com/img.zemanta.com/zemified_e.png?w=525)](http://www.zemanta.com/ "Enhanced by Zemanta")