PDA

View Full Version : converting to vb3


Dr.CustUmz
02-23-2016, 05:40 PM
i am trying to convert this backwards, to vB3.

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('showthreadwhoposted');
$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);

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

although i am un familiar with the way vb4 works and would appreciate some help. and an explanation why what gets changed.

just looking at it, the only part that really catches my eye that would need to be changed is
vB_Template::preRegister('SHOWTHREAD', array('posters' => $posters));

but playing around with it, and not getting any results is driving me crazy