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

Casey Bisson casey.bisson at gmail.com
Thu May 28 15:09:59 GMT 2009


On May 27, 2009, at 7:56 AM, scribu wrote:

> I like the ideea of making WordPress easier to extend in this
> direction, but I don't think that using the wp_comments table is
> always the best option - I'm thinking of community tagging when I say
> that.


Community tagging is a huge part of what I have in mind[1]. My focus  
is on establishing a common workflow and API that leverages what  
already works about comments (the comment moderation process,  
especially).

Though I suggested a column could be added to the wp_comments table, I  
much prefer creating a comments meta table that would related to  
wp_comments the same way wp_postmeta relates to wp_posts. wp_comments  
already stores the identity of the person submitting a comment, why  
not leverage that and the functions that depend on it for other user  
responses?

Taking the example of a user submitted tag, I imagine a plugin would  
intercept the input around the time of the preprocess_comment hook.  
The plugin would detect the presence of a tag and add another action  
for after the comment is stored in the database and a comment_ID is  
created. At that point, the plugin would save the tag(s) to the  
wp_commentmeta table, and the row in the wp_comments table may have an  
empty comment_content field. The meta_key for the data might be  
something like 'my_plug_user_tags' and the meta_value could be a  
serialized array of the tags and associated taxonomies submitted by  
the user.

If approved, the plugin could add the tag to the appropriate taxonomy  
for that post, or the plugin might instead only to add the tag to the  
post after some number of users have suggested the same tag.

The same workflow could also work for data that doesn't fit WP's  
taxonomy model. Users could also submit geographic locations via a map  
UI. The plugin that uses that data would have to manage a table to  
index the spatial data on its own, but the process for user input and  
moderation would be identical.

This process already sort of works for situations where the user  
response includes some text in the comment field; I can find a few  
examples of people adding additional fields to the comment form. The  
biggest challenge, aside from needing to put some content into the  
comment text field, is that the comment moderation tools inside WP  
aren't quite extensible enough to manage the input.


[1]: User tagging is one thing, I also need to allow users to  
(optionally) specify a taxonomy for the tag. The link below shows a  
photo archive where we'd like to allow users to suggest names, places,  
or other more specific data than simple tags (which would also be  
welcome):
http://archives.colby-sawyer.edu/browse/


--Casey

http://maisonbisson.com/
http://about.scriblio.net/




More information about the wp-hackers mailing list