Thread Stats
The {{ meerkat:thread_stats }} tag returns public comment counts for a thread. Users with view comments can add moderation counts with include_moderation="true".
#Example
1{{ meerkat:thread_stats }}
2 <p>
3 {{ total_comments }} comments,
4 {{ participants }} participants,
5 last reply {{ last_activity_at | relative }}
6 </p>
7{{ /meerkat:thread_stats }}
1<s-meerkat:thread_stats>
2 <p>
3 {{ $total_comments }} comments,
4 {{ $participants }} participants,
5 last reply {{ \Illuminate\Support\Carbon::parse($last_activity_at)->diffForHumans() }}
6 </p>
7</s-meerkat:thread_stats>
#Parameters
| Parameter | Default | Notes |
|---|---|---|
thread / from_thread |
current context | Choose a specific thread. |
site / locale |
current site | Restrict to one site. * includes all sites. Pass the site when requesting a thread from another site. |
include_moderation |
false |
Include moderation-only counts. Requires the view comments permission. Meerkat ignores it for other callers. |
#Variables
The tag returns:
| Variable | Type | Description |
|---|---|---|
thread_id |
string | Identifier |
site |
string | Site handle |
collection |
string | Collection handle |
total_comments |
integer | Visible comments, including unpublished comments for authorized moderation requests |
published_comments |
integer | Published comments |
pending_comments |
integer | Awaiting moderation. 0 unless include_moderation is set |
spam_comments |
integer | Flagged as spam. 0 unless include_moderation is set |
root_comments |
integer | Top-level (parent_id null) |
reply_comments |
integer | Nested |
participants |
integer | Distinct authors (by user ID or email) |
max_depth |
integer | Deepest reply nesting |
first_comment_at |
timestamp | When this thread was first commented on |
last_activity_at |
timestamp | Most recent activity |
Authorized moderation requests also receive metadata counts for checked_for_spam, guests, authenticated, and rejected_comments.
#Rebuild counts
Meerkat updates metrics during normal comment and moderation operations. After changing comment rows directly in the database, run:
1php artisan meerkat:sync-metrics