2024-02-18, 09:10 AM
I have this hook code to display the total number of thread participants .
But I don't know how to implement this hook in Hooks plugin by @frostschutz , because I have never have used it.
Please Help Someone
global $mybb, $db, $tid, $participants_num;
$query = $db->write_query("
SELECT DISTINCT u.uid, u.username, u.usergroup, u.displaygroup, u.avatar
FROM " . TABLE_PREFIX . "users u
LEFT JOIN " . TABLE_PREFIX . "posts p ON (p.uid = u.uid)
WHERE p.tid = '$tid'
ORDER BY p.dateline
");
$plural = '';
$num = $db->num_rows($query);
if ($num > 1) $plural = 's';
$participants_num = '<div class="participants">' . $num . ' participant' . $plural . '</div>';
global $mybb, $db, $tid, $participants;
$query = $db->write_query("
SELECT DISTINCT u.uid, u.username, u.usergroup, u.displaygroup, u.avatar
FROM " . TABLE_PREFIX . "users u
LEFT JOIN " . TABLE_PREFIX . "posts p ON (p.uid = u.uid)
WHERE p.tid = '$tid'
ORDER BY p.dateline
LIMIT 10
");
$participants = '<div class="participants"><span>';
while ($user = $db->fetch_array($query)) {
$avatar = "<img src='{$user['avatar']}' title='{$user['username']}' class='avatar'/>";
$participants .= build_profile_link($avatar, $user['uid']);
}
$participants .= '</span></div>';
}
But I don't know how to implement this hook in Hooks plugin by @frostschutz , because I have never have used it.
Please Help Someone