
- MODX 3
- PHP 8.2


Status: unverified on MODX 3. A current Tickets release for Revolution 3 is not available yet, so runtime checks wait for a compatible release.
The component API is generic: any object with class_key + object_id. For comments, expect class_key = TicketComment (or the package FQCN when it ships) and object = comment ID. The examples below are the target wiring.
<div class="comment-body">[[+text]]</div>
[[!Reactions?
&class=`TicketComment`
&object=`[[+id]]`
&set=`updown`
]]<div class="comment-body">{$text}</div>
{'!Reactions' | snippet : [
'class' => 'TicketComment',
'object' => $id,
'set' => 'updown',
]}[[!ReactionsCount?
&class=`TicketComment`
&object=`[[+id]]`
&format=`👍 {LIKES}`
]]{'!ReactionsCount' | snippet : [
'class' => 'TicketComment',
'object' => $id,
'format' => '👍 {LIKES}',
]}Tickets stores tickets as MODX resources. For reactions on the ticket page:
[[!Reactions? &set=`github`]]{'!Reactions' | snippet : ['set' => 'github']}[[!TopLiked?
&class=`TicketComment`
&period=`week`
&limit=`5`
&tpl=`tpl.top.comment`
]]{'!TopLiked' | snippet : [
'class' => 'TicketComment',
'period' => 'week',
'limit' => 5,
'tpl' => 'tpl.top.comment',
]}By rating:
[[!TopRated?
&class=`TicketComment`
&period=`month`
&limit=`10`
]]{'!TopRated' | snippet : [
'class' => 'TicketComment',
'period' => 'month',
'limit' => 10,
]}tpl.top.comment (MODX placeholders):
<li class="top-comment" data-idx="[[+idx]]">
<span class="top-comment__likes">[[+likes]] 👍</span>
<span class="top-comment__rating">rating: [[+rating]]</span>
<span class="top-comment__id">#[[+object_id]]</span>
</li>Fenom equivalent (@INLINE / file):
<li class="top-comment" data-idx="{$idx}">
<span class="top-comment__likes">{$likes} 👍</span>
<span class="top-comment__rating">rating: {$rating}</span>
<span class="top-comment__id">#{$object_id}</span>
</li>To link to a comment, load the TicketComment object by object_id in a separate snippet or via pdoTools.
Tickets comments usually render in the web context. The JS widget sends context from the data attribute. If comments live in another context, set context explicitly.
[[!Reactions?
&class=`TicketComment`
&object=`[[+id]]`
&set=`updown`
&context=`web`
]]{'!Reactions' | snippet : [
'class' => 'TicketComment',
'object' => $id,
'set' => 'updown',
'context' => 'web',
]}Ban an IP or user via CLI:
php core/components/reactions/cli.php ban add --ip=203.0.113.10 --reason=spam --days=7
php core/components/reactions/cli.php ban add --user=42 --reason=abuse