MyBB Community Forums

Full Version: How to use this hook in hook plugin?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have this hook code to display the total number of thread participants .

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
anyone?

nevermind I solved it...

if anybody needs the hook here it is

[attachment=46679]