Ras Masta
05-16-2004, 01:40 PM
I want to create a new module with CMPS. I want it to display from my reviews forum and I figured the easiest way to do this is to basically copy the latesttopics.php, modify the coding and then save it as latestreviews.php
My only problem is...how would I go about entering the forum ID number without doing it through the VBA Options.
if ($vba_options['portal_threads_maxthreads'])
{
if ($vba_options['portal_threads_forumids'])
{
if (!empty($forumperms))
{
$inforums = array();
$threadsforums = explode(',', $vba_options['portal_threads_forumids']);
foreach ($threadsforums AS $tforum)
{
if (!in_array($tforum, $forumperms))
{
$inforums[] = $tforum;
}
}
if (!empty($inforums))
{
$inforums = implode(',', $inforums);
}
}
else
{
$inforums = $vba_options['portal_threads_forumids'];
}
if ($inforums)
{
$inforum = 'AND thread.forumid IN (' . $inforums . ')';
}
}
$foruminfo['allowratings'] = $vba_options['portal_threads_showrating'];
$show['lastpost'] = $vba_options['portal_threads_lastpost'];
if ($vba_options['portal_threads_showsubscribed'] AND $bbuserinfo['userid'])
{
$subfields = ', NOT ISNULL(subscribethread.subscribethreadid) AS subscribed';
$subjoin = 'LEFT JOIN ' . TABLE_PREFIX . 'subscribethread AS subscribethread ON (subscribethread.threadid = thread.threadid AND subscribethread.userid = ' . $bbuserinfo['userid'] . ')';
}
if ($vba_options['portal_threads_showpreview'] AND $vboptions['threadpreview'])
{
$previewfields = ', post.pagetext AS preview';
$previewjoin = 'LEFT JOIN ' . TABLE_PREFIX . 'post AS post ON (post.postid = thread.firstpostid)';
}
if ($vba_options['portal_threads_showforum'])
{
$forumfields = ',thread.forumid, forum.title AS forumtitle';
$forumjoin = 'LEFT JOIN ' . TABLE_PREFIX . 'forum AS forum ON (thread.forumid = forum.forumid)';
}
if ($vba_options['portal_threads_showicon'])
{
$iconfields = ', thread.iconid AS threadiconid, iconpath AS threadiconpath';
$iconjoin = 'LEFT JOIN ' . TABLE_PREFIX . 'icon USING (iconid)';
}
$threads = $DB_site->query("
SELECT
" . iif($vba_options['portal_threads_showrating'], 'IF(votenum >= ' . $vboptions['showvotes'] . ', votenum, 0) AS votenum, IF(votenum >= ' . $vboptions['showvotes'] . ' AND votenum != 0, votetotal / votenum, 0) AS voteavg,') . "
thread.threadid, thread.title, thread.replycount, postusername, postuserid, thread.dateline AS postdateline, IF(views <= thread.replycount, thread.replycount+1, views) AS views, thread.lastposter, thread.lastpost, pollid
$iconfields
$forumfields
$previewfields
$subfields
FROM " . TABLE_PREFIX . "thread as thread
$iconjoin
$forumjoin
$previewjoin
$deljoin
$subjoin
WHERE open <> '10' AND thread.visible = 1 $iforumperms $inforum $notdeleted
ORDER BY lastpost DESC
LIMIT $vba_options[portal_threads_maxthreads]
");
while ($thread = $DB_site->fetch_array($threads))
{
if (strlen($thread['title']) > $vba_options['portal_threads_maxchars'] AND $vba_options['portal_threads_maxchars'])
{
$thread['title'] = fetch_trimmed_title($thread['title'], $vba_options['portal_threads_maxchars']);
}
$thread = process_thread_array($thread, '', $vba_options['portal_threads_showicon']);
$getbgrow = getrowcolor();
eval('$threadbits .= "' . fetch_template('adv_portal_latesttopicbits') . '";');
}
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_latesttopics') . '";');
$DB_site->free_result($threads);
unset($thread, $foruminfo['allowratings']);
}
My only problem is...how would I go about entering the forum ID number without doing it through the VBA Options.
if ($vba_options['portal_threads_maxthreads'])
{
if ($vba_options['portal_threads_forumids'])
{
if (!empty($forumperms))
{
$inforums = array();
$threadsforums = explode(',', $vba_options['portal_threads_forumids']);
foreach ($threadsforums AS $tforum)
{
if (!in_array($tforum, $forumperms))
{
$inforums[] = $tforum;
}
}
if (!empty($inforums))
{
$inforums = implode(',', $inforums);
}
}
else
{
$inforums = $vba_options['portal_threads_forumids'];
}
if ($inforums)
{
$inforum = 'AND thread.forumid IN (' . $inforums . ')';
}
}
$foruminfo['allowratings'] = $vba_options['portal_threads_showrating'];
$show['lastpost'] = $vba_options['portal_threads_lastpost'];
if ($vba_options['portal_threads_showsubscribed'] AND $bbuserinfo['userid'])
{
$subfields = ', NOT ISNULL(subscribethread.subscribethreadid) AS subscribed';
$subjoin = 'LEFT JOIN ' . TABLE_PREFIX . 'subscribethread AS subscribethread ON (subscribethread.threadid = thread.threadid AND subscribethread.userid = ' . $bbuserinfo['userid'] . ')';
}
if ($vba_options['portal_threads_showpreview'] AND $vboptions['threadpreview'])
{
$previewfields = ', post.pagetext AS preview';
$previewjoin = 'LEFT JOIN ' . TABLE_PREFIX . 'post AS post ON (post.postid = thread.firstpostid)';
}
if ($vba_options['portal_threads_showforum'])
{
$forumfields = ',thread.forumid, forum.title AS forumtitle';
$forumjoin = 'LEFT JOIN ' . TABLE_PREFIX . 'forum AS forum ON (thread.forumid = forum.forumid)';
}
if ($vba_options['portal_threads_showicon'])
{
$iconfields = ', thread.iconid AS threadiconid, iconpath AS threadiconpath';
$iconjoin = 'LEFT JOIN ' . TABLE_PREFIX . 'icon USING (iconid)';
}
$threads = $DB_site->query("
SELECT
" . iif($vba_options['portal_threads_showrating'], 'IF(votenum >= ' . $vboptions['showvotes'] . ', votenum, 0) AS votenum, IF(votenum >= ' . $vboptions['showvotes'] . ' AND votenum != 0, votetotal / votenum, 0) AS voteavg,') . "
thread.threadid, thread.title, thread.replycount, postusername, postuserid, thread.dateline AS postdateline, IF(views <= thread.replycount, thread.replycount+1, views) AS views, thread.lastposter, thread.lastpost, pollid
$iconfields
$forumfields
$previewfields
$subfields
FROM " . TABLE_PREFIX . "thread as thread
$iconjoin
$forumjoin
$previewjoin
$deljoin
$subjoin
WHERE open <> '10' AND thread.visible = 1 $iforumperms $inforum $notdeleted
ORDER BY lastpost DESC
LIMIT $vba_options[portal_threads_maxthreads]
");
while ($thread = $DB_site->fetch_array($threads))
{
if (strlen($thread['title']) > $vba_options['portal_threads_maxchars'] AND $vba_options['portal_threads_maxchars'])
{
$thread['title'] = fetch_trimmed_title($thread['title'], $vba_options['portal_threads_maxchars']);
}
$thread = process_thread_array($thread, '', $vba_options['portal_threads_showicon']);
$getbgrow = getrowcolor();
eval('$threadbits .= "' . fetch_template('adv_portal_latesttopicbits') . '";');
}
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_latesttopics') . '";');
$DB_site->free_result($threads);
unset($thread, $foruminfo['allowratings']);
}