LAN_Portal/chat/features/mentions.php
2026-10-16 16:22:59 -04:00

8 lines
451 B
PHP
Executable file

<?php
if (!defined('PORTAL')) { http_response_code(403); exit; }
// Mentions: "@john" is highlighted. Pairs with mentions.js, which highlights messages that mention you.
// A mention is "@" at the start of a word followed by letters/digits; it matches anyone whose name starts with that.
chat_on('render_text', function ($html) {
return preg_replace('/(?<!\S)@(\w+)/u', '<mark class="chat-mention px-1" data-mention="$1">@$1</mark>', $html);
});