PDA

View Full Version : Change forum ID "Where" location in PHP!


MarkFoster
04-15-2009, 10:15 PM
I want to edit something in my PHP file.
This is what I want changed:
WHERE thread.forumid = " . intval($vbulletin->options['rwc_newsforum']) . "
I want to change it so I can type a forum ID right there instead of it loading from a vbulletin option.
Below is the full code.
<?php
unset($latestnewsbits);

$threads = $vbulletin->db->query_read("
SELECT thread.threadid, thread.title, thread.iconid, thread.dateline, thread.postusername, thread.postuserid,
post.pagetext
FROM " . TABLE_PREFIX . "thread AS thread
INNER JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.firstpostid)
WHERE thread.forumid = " . intval($vbulletin->options['rwc_newsforum']) . "
ORDER BY thread.dateline DESC
LIMIT 5
");

while ($thread = $vbulletin->db->fetch_array($threads))
{
$dateposted = vbdate("jS F Y \\- g:iA", $thread['dateline']);
$message = fetch_trimmed_title(strip_bbcode($thread['pagetext'], true, true), 200);

eval('$latestnewsbits .= "' . fetch_template('rwc_latestnews_bit') . '";');
}

$can_moderate_rwc = can_moderate(intval($vbulletin->options['rwc_newsforum']));

eval('$home["$mods[modid]"][\'content\'] = "' . fetch_template('rwc_latestnews') . '";');

?>

BBR-APBT
04-15-2009, 10:21 PM
WHERE thread.forumid = "forumid"


Just replace forumid with the numerical id of the forum.
This should work let me know if you have any problems.

Carnage
04-15-2009, 10:29 PM
$threads = $vbulletin->db->query_read("
SELECT thread.threadid, thread.title, thread.iconid, thread.dateline, thread.postusername, thread.postuserid,
post.pagetext
FROM " . TABLE_PREFIX . "thread AS thread
INNER JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.firstpostid)
WHERE thread.forumid = <number>
ORDER BY thread.dateline DESC
LIMIT 5 ");


the above code is slightly misleading; so i posted you the whole query. replace <number> with the forum id you want

MarkFoster
04-15-2009, 10:53 PM
$threads = $vbulletin->db->query_read("
SELECT thread.threadid, thread.title, thread.iconid, thread.dateline, thread.postusername, thread.postuserid,
post.pagetext
FROM " . TABLE_PREFIX . "thread AS thread
INNER JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.firstpostid)
WHERE thread.forumid = <number>
ORDER BY thread.dateline DESC
LIMIT 5 ");


the above code is slightly misleading; so i posted you the whole query. replace <number> with the forum id you want

That's odd, when I add your code the entire page I use the module on breaks, however if I turn it back to what it was before then it works fine.

Dismounted
04-16-2009, 01:27 AM
Did you add all the other code?
<?php
unset($latestnewsbits);

$threads = $vbulletin->db->query_read("
SELECT thread.threadid, thread.title, thread.iconid, thread.dateline, thread.postusername, thread.postuserid,
post.pagetext
FROM " . TABLE_PREFIX . "thread AS thread
INNER JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.firstpostid)
WHERE thread.forumid = PUTFORUMIDHERE
ORDER BY thread.dateline DESC
LIMIT 5
");

while ($thread = $vbulletin->db->fetch_array($threads))
{
$dateposted = vbdate("jS F Y \\- g:iA", $thread['dateline']);
$message = fetch_trimmed_title(strip_bbcode($thread['pagetext'], true, true), 200);

eval('$latestnewsbits .= "' . fetch_template('rwc_latestnews_bit') . '";');
}

$can_moderate_rwc = can_moderate(intval($vbulletin->options['rwc_newsforum']));

eval('$home["$mods[modid]"][\'content\'] = "' . fetch_template('rwc_latestnews') . '";');

?>

MarkFoster
04-16-2009, 03:47 AM
Did you add all the other code?
<?php
unset($latestnewsbits);

$threads = $vbulletin->db->query_read("
SELECT thread.threadid, thread.title, thread.iconid, thread.dateline, thread.postusername, thread.postuserid,
post.pagetext
FROM " . TABLE_PREFIX . "thread AS thread
INNER JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.firstpostid)
WHERE thread.forumid = PUTFORUMIDHERE
ORDER BY thread.dateline DESC
LIMIT 5
");

while ($thread = $vbulletin->db->fetch_array($threads))
{
$dateposted = vbdate("jS F Y \\- g:iA", $thread['dateline']);
$message = fetch_trimmed_title(strip_bbcode($thread['pagetext'], true, true), 200);

eval('$latestnewsbits .= "' . fetch_template('rwc_latestnews_bit') . '";');
}

$can_moderate_rwc = can_moderate(intval($vbulletin->options['rwc_newsforum']));

eval('$home["$mods[modid]"][\'content\'] = "' . fetch_template('rwc_latestnews') . '";');

?>

Thanks a lot! It works great now!