PDA

View Full Version : Who Has Posted Display Help


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);
}

grey_goose
09-06-2015, 12:23 PM
Ack, really? No one can help me figure out how to show who's posted in the SHOWTHREAD ?

grey_goose
09-21-2015, 12:53 PM
bump

Lynne
09-21-2015, 03:31 PM
You forgot to preregister the variable for use in the template.

vB_Template::preRegister('SHOWTHREAD', array('posters' => $posters));

grey_goose
09-21-2015, 03:59 PM
Thank you so much!

*facepalm*

grey_goose
09-21-2015, 05:11 PM
Just to show the final version, now posters in a thread are displayed at the top. Thanks again, Lynne.

Lynne
09-21-2015, 08:21 PM
Looks nice! You should release it as a mod. :)

grey_goose
09-21-2015, 10:21 PM
Yes ma'am :)

https://vborg.vbsupport.ru/showthread.php?t=320315

Lynne
09-22-2015, 12:30 AM
Thank you. :)