Plugin Directory

Featuring CountComments

Functions

Functions for Post or Comment Templates

  • function fcc_get_comment_count($comment)

    • Returns the number of comments made by the author of this comment
    • parameters: $comment: current comment structure
  • function fcc_comment_count($zero='0 comments', $one='1 comment', $more='%c comments')

    • Displays the number of comments made by the author of the current comment in the comment loop
    • parameters: $zero, $one, $more: %c get replaced with the number of comments.

Functions for Author Pages

  • function fcc_get_count_comments_author($author)

    • Returns the number of comments made by someone with this display name
    • parameters: $author: name of user to count comments for
  • function fcc_get_count_comments_authorID($authorID)

    • same as above, but based on ID instead of the author's name
    • parameters: $authorID: name of user to count comments for
  • function fcc_count_comments_author($zero='0 comments', $one='1 comment', $more='%c comments')

    • Displays the number of comments made by the author who is currently logged in
    • parameters: $zero, $one, $more: %c get replaced with the number of comments.
  • function fcc_count_comments_by_author($zero='0 comments', $one='1 comment', $more='%c comments', $author)

    • Displays the number of comments made by a specified author with this display name
    • parameters: $zero, $one, $more: %c get replaced with the number of comments, $author: the authors display name
  • function fcc_count_comments_by_authorID($zero='0 comments', $one='1 comment', $more='%c comments', $authorID)

    • same as above, but based on ID instead of the author's name
    • parameters: $zero, $one, $more: %c get replaced with the number of comments, $authorID: the authors id

Remarks

  • Authors' nicknames (display names) and ids can be used to query for commenters. Though, the internal structure is based on the authors' id and will therefore only produce results of comments, which have been written by authors who have been logged in at the time of writing the comment.
  • Already queried results are re-used within a single page-call to avoid performing too many queries. This results in increased performance.
  • Nevertheless, if the number of comments gets really big, it would be better to cache the counts in the database instead of calculating them on every page-call.

Download

FYI

Compatibility beta

Your Setup

Log in to vote.

The Consensus (1 reporting)

100%
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(5 ratings)