Return to Snippet

Revision: 36066
at November 17, 2010 14:29 by wpCanyon


Initial Code
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;

}

Initial URL
http://wpcanyon.com/tipsandtricks/showing-amount-of-comments-a-comment-author-made/

Initial Description

                                

Initial Title
Showing Amount Of Comments A Comment Author Made

Initial Tags
wordpress

Initial Language
PHP