', $after = '', $exclude_emails = '') { global $wpdb, $tablecomments; if (!isset($tablecomments)) $tableoptions = $wpdb->comments; $request = "SELECT DISTINCT comment_author, comment_author_url, comment_author_email FROM $tablecomments WHERE comment_approved = '1'"; if ($exclude_emails != '') { $exclude_email_array = explode(' ',$exclude_emails); for ($i = 0; $i < count($exclude_email_array); $i++) { $request .= " AND comment_author_email <> '".$exclude_email_array[$i]."'"; } } $request .= " ORDER BY comment_ID DESC LIMIT $no_commenters"; $comments = $wpdb->get_results($request); $output = ''; if ($comments) { foreach ($comments as $comment) { $comment_author = stripslashes($comment->comment_author); $comment_author_url = $comment->comment_author_url; $output .= $before . '' . $comment_author . ''; $requestTotalComments = "SELECT COUNT(comment_ID) FROM $tablecomments WHERE comment_author = '".$comment->comment_author."' AND comment_author_url = '".$comment->comment_author_url."' AND comment_author_email = '".$comment->comment_author_email."'"; $totalComments = $wpdb->get_var($requestTotalComments); $output .= " (".$totalComments.")"; $output .= $after; } echo $output; } } function get_recent_commented_on ($no_posts = 5, $before = '
  • ', $after = '
  • ', $show_pass_post = false) { global $wpdb, $tablecomments, $tableposts; if (!isset($tablecomments)) $tableoptions = $wpdb->comments; if (!isset($tableposts)) $tableoptions = $wpdb->posts; $request = "SELECT DISTINCT $tableposts.ID, $tablecomments.comment_post_ID, $tableposts.post_title FROM $tablecomments, $tableposts WHERE $tableposts.ID=$tablecomments.comment_post_ID and comment_approved = '1' AND post_status = 'publish'"; if(!$show_pass_post) $request .= "AND post_password ='' "; $request .= "ORDER BY comment_ID DESC LIMIT $no_posts"; $comments = $wpdb->get_results($request); if ($comments) { foreach ($comments as $comment) { $link = get_permalink($comment->comment_post_ID); $title = stripslashes($comment->post_title); $output .= $before . '' . $title . ''.$after; } echo $output; } } ?>