Sitewide Comment Tracking Revisited

Update December 29, 2015: This post is part of the WPMU DEV Blog archive and contains information that is out-of-date, but we’re keeping it on the blog for posterity. For all the latest WordPress news and resources, check out the WPMU DEV Blog.

Useful for tracking comments by community users with output visible in:
Dashboard–>Comments–>My Comments.

Plugin enhancements:

(see Competition eligibility note below)

  • WPMU 2.6 style
  • Avatars
  • Recent post excerpt display
  • “My Comment” listed first, follwed by most recent reply by someone else.
  • Message display for archived/deleted/spam blogs; deleted/unpublished posts, approved/moderated/spam/deleted comments – hence …
  • “Dismiss” link to stop tracking each post
  • Paged display table
  • Re-definable constants(in code) to modify array outputs.
    • MY_COMMENTS_TRACKED = `if (count($LatestCommentsList) > MY_COMMENTS_TRACKED) { unset($LatestCommentsList[0]); …}` during a comment save a blog_id, post_id pair is entered into usermeta->LatestComments, the total counted and when the array exceeds limit, the oldest pair is deleted = 100
    • MY_POSTS_APAGE = more posts per page = increased work for CPU = 10
    • MY_COMMENTS_APOST = more comments per post = increased work for CPU = 1
    • POST_EXCERPT_LENGTH =`$post_output = wp_html_excerpt($post_output, POST_EXCERPT_LENGTH);` 400 chars

Performance notes: tested on a small WPMU install(>200 blogs). I have not seen how this version performs “maxed out” on my own install yet. I do not know how this plugin performs in a large install. An array of “Blog_id, post_id” pairs are stored in usermeta->LatestComments to a defined maximum, called then sliced by page number, looped to retrieve posts, then each post looped to retrieve comments – “My Comments” and “Other comments”. The bottom of the My Comments page has a numqueries count, FYI(if SiteAdmin). Redefining the MY_POSTS_APAGE constant can throttle the page.

Known Bugs: redefining the MY_COMMENTS_TRACKED constant to a lower limit after users have “maxed out” the previous limit will only unset one comment after each comment submit(“update_usermeta(…)”) thereafter. Such users will continue to exceed MY_COMMENTS_TRACKED Limit until they “dismiss” enough comments to be below the newly defined limit.

Install Notes: drop in mu-plugin, monitor performace/cpu load as “usermeta->LatestComments” data fills with each user comment submitted to defined maximum(MY_COMMENTS_TRACKED). I have not tested this revised version under heavy load. Happy testing!

Competition eligibility note: this plugin is a significantly revised/enhanced/twisted version of WPMU-User-Comment-Tracking-and-DisplayThis work is Copyright GNU GPL You and Your Loved Ones. And: – Xiando (Oyvind Sather), who originally wrote it – And D. Sader – and is intended to add similar functionality(with a few twists) as Matt’s popular My Comments feature. On that basis, I’d accept a decision by the judges to exclude this plugin from the contest.