[wp-hackers] when comments aren't enough...a generic user-response mechanism?

Casey Bisson casey.bisson at gmail.com
Wed May 27 01:20:29 GMT 2009

User tagging, post ranking, reporting offensive content, and crowd- 
sourced copy edits are just a few of a number of user-responses to  
blog content that don't quite fit WordPress' comment model.

There are a few plugins in this space; I use Lester Chan's WP Post  
Ratings, and I'm one of the few that uses Matt's Community Tags  
plugin, but those and others suffer from having to invent their own  
input, moderation, and storage mechanisms. Comparing that landscape to  
plugins related to extending the type of data that can be input with  
posts makes one wonder if the comment system could be extended in ways  
similar to posts to accommodate more types of user input.

Leveraging comments to allow the input, moderation, and storage of a  
larger variety of user responses rather than just comments requires  
just a few changes to WP's behavior.

At the time a comment is submitted, the preprocess_comment hook allows  
plugins to capture non-comment input and associate it with the  
$comment array that is passed through the system. The only problem is  
that user responses that don't include comment text are rejected by wp- 
comments-post.php before the preprocess_comment hook can act.

Storage of the additional data could follow the post meta model, or an  
additional field could be added to the comment table into which any  
extra elements of the $comments array are serialized.

Moderation of these non-comment user responses could leverage the  
current comment moderation tools with addition of hooks (similar to  
those now available on the plugins page) that would add features to  
each row of the display based on the data in that row. A hook would be  
needed to allow plugins to display a textual representation of the  
input ("suggested a tag: stuff" or "rated the post 5 stars" or "marked  
comment #123 as offensive") Approving, deleting, and spamming actions  
are probably appropriate to a majority of audience responses, but  
plugins should be able to set their own actions.




More information about the wp-hackers mailing list