Slug: voteback Date: 2006-12-22 Title: VoteBack layout: post
I've been hacking on a Wordpress implementation of VoteLinks - one that actually discovers if the incoming link contains a vote in the form of a
rev attribute with one of the vote-link values:
My implementation is currently based on modifications of
and and a custom plugin called VoteBack. VoteBack uses can discover if an incoming pingback came from a link containing a VoteLink, and it recognizes incoming Trackbacks with a
votelink=vote-* key=value pair.
Based on feedback on the trac issue, I've changed the plugin to not use the custom
trackback\_extend_comment hook, instead checking
$\_POST for the info right in
preprocess\_comment. Included is the modified xmlrpc.php that patches
pingback\_ping you'll need to grab the extra data from the pingback.
Also, hopefully the pingback link data will be added to $commentdata so that
pingback\_extend\_comment will go away as well.
To make this less hack-dependent, several new hooks will need to be added to WordPress. I've implemented the plugin as a filter on a new hook, 'pingback_link'.
$extended\_data = apply\_filters('pingback\_link', array($link\_anchor, array()));
The VoteBack plugin parses the link anchor (the complete anchor tag for the pingback-discovered incoming link) for the vote and if found, it adds a 'votelink'=>'thevote' pair to the array that was passed in, then returns it. Afterwards,
$extended_data is merged with $commentdata and is then passed to
wp\_new\_comment(), WordPress applies the 'preprocess_comment' filter, so VoteBack adds a filter on 'preprocess_comment' and if the comment data contains a 'comment_vote' key it modifies the title of the comment (really the author's name right now) and adds " (Agreeing)" or "( Disagreeing)". Rudimentary, but functional.
For a demo see the first comment on: Votelinks+Trackback=VoteBack?
As far as I can tell, two entry points are needed: one for plugins to access trackback info (including any exteneded values that have been sent) before it's posted as a comment, and one for plugins to process the pingback link and modify the commentdata based on what they find.
These are rough ideas and I hope that some will look at them and provide suggestions for improvements. I'm not going to release the code quite yet, but you can link to any post on this site now and if you include a vote-link, your agreement or disagreement will be noted in the posted comment.
###Try It Out
- VoteBack experimental plugin (with fixes)
- Wordpress Trac issue with patches for xmlrpc.php and wp-trackback.php that add hooks
- VoteLink UI thoughts
- The inspiration - Thanks Jeremy!