I thank you in advance for your help. I am using Wordpress for about 2 years, but always avoiding SQL inside my scripts and looking for built-in functions to perform my goals.
To count the comments submitted by a specific user with
$user->ID as id, I didn't find a built-in way, so I am using:
global $wpdb; $count = $wpdb->get_var( 'SELECT COUNT( comment_id ) FROM '. $wpdb->comments .' WHERE user_id = '.$user->ID.' AND comment_approved = "1" AND comment_type NOT IN ("pingback", "trackback" )' );
Actually my goal is to count number of all comments by a user on different posts. In other words, if a user commented 2 or more times on the same post, then only increment the
$count variable by one .
Your help is appreciated.