[wp-hackers] function to show total comments by user

Simon Blackbourn piemanek at gmail.com
Sun Jan 16 21:47:37 UTC 2011


> reading trough the codex for get_comments() there's not a single word about
> the 'count' option...
>

i tend to also look at the function directly in the source code as the codex
is often incomplete. in this case the function is defined in
wp-includes/comment.php.


I think your solution also doesn't show the total comments for unregistered
> users. I could use 'author_email' instead of 'user_id' but at this point I
> don't know how to retrieve the email associated with the commenter.
>

sorry, yes you're right, i hadn't noticed that bit in your original
question. get_comment_author_email will help you.



> Also trying to use your solution it returned an array, so I suppose the
> 'count' parameter doesn't work...
>

it does normally return an array, but if you pass in the count parameter it
returns a single value instead. i've just tested this on one of my sites and
it's working for me.


More information about the wp-hackers mailing list