I have set some custom meta against certain comments for users using this function: add_comment_meta( $wp_comment_id, 'accepted', true );
What I want to do is show for each user on their profile /author/username is how many of these special comments they have so for example if a user made 20 comments and 5 had this meta data of accepted equalling true then the value would be 5.
How could I do this? Thanks.
I’m assuming this is the latest version of wordpress. You can see the database schema diagram here: http://codex.wordpress.org/images/9/9e/WP3.0-ERD.png
I haven’t tested this, but something LIKE this should do the trick:
i dont understand what do you mean by “count meta data”…
whice value in meta data.. do you mean the user’s meta data or the comment.
Anyhow – in order to count comments by a specific user you can…
Put this code in your functions php
The you can use it anywhere where you got a user id available to you like so
.
Hope this helps anyone 😉
Cheers, Sagive