For a private wordpress site I have been using a custom comments table. It just has an added row where people rate the business. Everything is included in the comments table where I don’t need to make a custom table for the ip address, the name, blah blah blah. So now with wordpress 2.9 they have added custom fields for comments so this eliminates the use of me having to do this, YAAAA!
Using custom fields for comments is just like using custom fields for wordpress.
So instead of using: update_post_meta('postid', 'customfield', 'customfieldvalue');
We now use: update_comment_meta('postid', 'customfield', 'customfieldvalue');
So in your plugin or functions.php file you can just do this:
add_action('comment_post','comment_rating');
function comment_rating($comment_id) {
global $wpdb, $user_identity, $user_ID;
$star = $_POST['rating'];
update_comment_meta('postid', 'rating', $star);
}
Again you need to add a rating drop down in your comments.php file (example): <input type=”radio” name=”rating” id=”vote1″ value=”1″ />
thanks for this tips… very helpfull to me….
Nice! Can’t believe I wasn’t able to figure that out myself. :/
Превосходно!!!