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″ />
Idea; Use WordPress as RSVP System
So I had a friend who was looking for a simple to use RSVP system. I spent half today looking into ways to use custom fields as a way to track names and emails. Thats a good way if you don’t need to count plusses. But I needed a way to count plusses and assosiate the name with an email address. So using custom fields is out of the question.
So then I decided that instead of using custom fields, why not just use the comment system and edit the comment box to be a pull down menu.
So how it works as of now, is everytime there is a new post in the event category. The comment field is changed to a drop down list of plusses one to three. And we don’t want the rsvp’s to be shown to regular users and to only the admin, so I added this line to view comments, so only comments are shown to the admin:
I am making a backend that will show the name and rsvp’s in alphabetical order.
Just an idea.