grey_goose
08-28-2015, 12:22 PM
I'd like to have threads display a list at the top of who has currently posted in the thread. I know this information is accessible through "misc.php?do=whoposted&t=xxx" but I think that adding it to showthread would make it more accessible.
In WHOPOSTED, there is a {vb:raw posters}. I copied the code from misc.php for this section and created a plugin at showthread_getinfo, but when I add {vb:raw posters} to SHOWTHREAD, nothing appears.
Ideas?
Plugin:
if (!$threadinfo['threadid'] OR $threadinfo['isdeleted'] OR (!$threadinfo['visible'] AND !can_moderate($threadinfo['forumid'], 'canmoderateposts')))
{
eval(standard_error(fetch_error('invalidid', $vbphrase['thread'], $vbulletin->options['contactuslink'])));
}
($hook = vBulletinHook::fetch_hook('misc_whoposted_start')) ? eval($hook) : false;
$posts = $db->query_read_slave("
SELECT COUNT(postid) AS posts,
post.username AS postuser,user.userid,user.username
FROM " . TABLE_PREFIX . "post AS post
LEFT JOIN " . TABLE_PREFIX . "user AS user USING(userid)
WHERE threadid = $threadinfo[threadid]
AND visible = 1
GROUP BY userid
ORDER BY posts DESC
");
$totalposts = 0;
$posters = '';
if ($db->num_rows($posts))
{
require_once(DIR . '/includes/functions_bigthree.php');
while ($post = $db->fetch_array($posts))
{
// hide users in Coventry
$ast = '';
if (in_coventry($post['userid']) AND !can_moderate($threadinfo['forumid']))
{
continue;
}
exec_switch_bg();
if ($post['username'] == '')
{
$post['username'] = $post['postuser'];
}
$post['username'] .= $ast;
$totalposts += $post['posts'];
$post['posts'] = vb_number_format($post['posts']);
$show['memberlink'] = iif ($post['userid'], true, false);
$templater = vB_Template::create('whopostedbit');
$templater->register('bgclass', $bgclass);
$templater->register('post', $post);
$templater->register('threadinfo', $threadinfo);
$posters .= $templater->render();
}
$totalposts = vb_number_format($totalposts);
($hook = vBulletinHook::fetch_hook('misc_whoposted_complete ')) ? eval($hook) : false;
$templater->register_page_templates();
$templater->register('posters', $posters);
$templater->register('threadinfo', $threadinfo);
$templater->register('totalposts', $totalposts);
}
In WHOPOSTED, there is a {vb:raw posters}. I copied the code from misc.php for this section and created a plugin at showthread_getinfo, but when I add {vb:raw posters} to SHOWTHREAD, nothing appears.
Ideas?
Plugin:
if (!$threadinfo['threadid'] OR $threadinfo['isdeleted'] OR (!$threadinfo['visible'] AND !can_moderate($threadinfo['forumid'], 'canmoderateposts')))
{
eval(standard_error(fetch_error('invalidid', $vbphrase['thread'], $vbulletin->options['contactuslink'])));
}
($hook = vBulletinHook::fetch_hook('misc_whoposted_start')) ? eval($hook) : false;
$posts = $db->query_read_slave("
SELECT COUNT(postid) AS posts,
post.username AS postuser,user.userid,user.username
FROM " . TABLE_PREFIX . "post AS post
LEFT JOIN " . TABLE_PREFIX . "user AS user USING(userid)
WHERE threadid = $threadinfo[threadid]
AND visible = 1
GROUP BY userid
ORDER BY posts DESC
");
$totalposts = 0;
$posters = '';
if ($db->num_rows($posts))
{
require_once(DIR . '/includes/functions_bigthree.php');
while ($post = $db->fetch_array($posts))
{
// hide users in Coventry
$ast = '';
if (in_coventry($post['userid']) AND !can_moderate($threadinfo['forumid']))
{
continue;
}
exec_switch_bg();
if ($post['username'] == '')
{
$post['username'] = $post['postuser'];
}
$post['username'] .= $ast;
$totalposts += $post['posts'];
$post['posts'] = vb_number_format($post['posts']);
$show['memberlink'] = iif ($post['userid'], true, false);
$templater = vB_Template::create('whopostedbit');
$templater->register('bgclass', $bgclass);
$templater->register('post', $post);
$templater->register('threadinfo', $threadinfo);
$posters .= $templater->render();
}
$totalposts = vb_number_format($totalposts);
($hook = vBulletinHook::fetch_hook('misc_whoposted_complete ')) ? eval($hook) : false;
$templater->register_page_templates();
$templater->register('posters', $posters);
$templater->register('threadinfo', $threadinfo);
$templater->register('totalposts', $totalposts);
}