I announce that I cease all development and activity in the programming universe indefinitely. My career has reached the turning point I was not expecting for at least another year, leaving me highly off guard and without laid-out plans for this hobby's continuity. I have begun a 5-year residency program in Neurosurgery which is clearly not compatible, time-wise, with programming.
I gave in all my passion for developing, and you gave me back your loyalty and trust, even when I did not deserve that much. Now it is the time for payback. I release all my present and past work as Open Source software, in the hope some talented developer will continue maintaining and expanding my vision of a modern, sleek forum software. The intrinsic flexibility of MyBB is the true hidden gem of an otherwise outdated codebase; I do hope the project can continue and be updated complying to the latest coding standards.
I hereby thank Euan, kawaii, andrewjs18, Ben, Matt, Omar G., effone, Eric J., Devilshakerz, Wildcard, JordanMussi and all the other team members I have had the opportunity to work with when I was a MyBB team member. I thank Tomm M, my mentor, who inspired me to pick up coding with his piece-of-art plugins. And finally, I thank all of you MyBBoost subscribers who have helped me getting through my toughest university years economically.
Yours sincerely, Filippo
The template is very ugly, but that just works fine in my case. I can then reference {$participants} into the showthread template. If you are wondering, I am using Hooks by frostschutz to apply this small enhancement.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
");
$plural = '';
$num = $db->num_rows($query);
if ($num > 1) $plural = 's';
$participants = '<div class="participants"><h4>' . $num . ' participant' . $plural . '</h4><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>';
If you want to show the real number of participants alongside the last 10 participants, things are a bit more complex as you will need to write down a separate COUNT query.$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
");
Use {$participants} for avatars and {$participants_num} for number of 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>';
}
Which is faster as you don't need to join multiple tables. I'd also subtract the 10 participants to show the last 10 with the avatar, and a label with "... and X more" or something like this.$query = $db->simple_select('posts', 'COUNT(DISTINCT(uid)) AS count', 'tid = ' . $tid);
$num = $db->fetch_field($query, 'count');
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
");
$plural = '';
$num = $db->num_rows($query);
if ($num > 1) $plural = 's';
$participants = '<div class="participants"><h5>' . $num . ' participant' . $plural . '</h5><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>';
I am using this, but once there are 30 participants, it gets over the "new reply" button. I don't like to limit, but i want to show all participants, whether the number is high or not.