Here is just a small code snippet I found for showing the amount of comments a comment author made.

Here’s a function you can use to get and echo the number of comments a comment author made. It’s pretty easy just put it in the functions.php file in your theme.

function commentCountAuthor(){

	$oneText = 'One comment';
	$moreText = '% comments';

	global $wpdb;

	$result = $wpdb->get_var('
		SELECT
			COUNT(comment_ID)
		FROM
			'.$wpdb->comments.'
		WHERE
			comment_author_email = "'.get_comment_author_email().'"'
	);

	if($result == 1): 

		echo str_replace('%', $result, $oneText);

	elseif($result > 1): 

		echo str_replace('%', $result, $moreText);

	endif;

}

Then just call the function inside the comments loop and shazam! Magic!

commentCountAuthor();

Feedback

  Comments: 30


    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

      Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

        Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

          Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

      Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

        Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

      Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

        Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

      Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

      Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

      Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

      Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

      Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

      Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

        Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

      Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

    Warning: call_user_func() expects parameter 1 to be a valid callback, function 'srh_comment' not found or invalid function name in /nfs/c08/h01/mnt/171249/domains/brewerjwebdesign.com/html/wp-includes/class-walker-comment.php on line 180

Your feedback