PDA

View Full Version : Any ideas why this simple plug-in doesn't work in 3.8?


Razasharp
12-10-2009, 12:02 AM
It gets the latest threads from certain forums, works fine in 3.7 but not 3.8.

hook location - forumhome_start

$threads = $vbulletin->db->query_read("
SELECT threadid, title
FROM " . TABLE_PREFIX . "thread
WHERE sticky=0 AND visible=1 AND (forumid = '45' OR forumid = '135' OR forumid = '136')
ORDER BY dateline DESC
LIMIT 5
");

$latestthreads = "<ul>\n";

while ($thread = $vbulletin->db->fetch_array($threads))
{
$latestthreads .= ' <li><a href="showthread.php?' . $session['sessionurl'] . 't=' . $thread['threadid'] . '">' . $thread['title'] . '</a></li>
';
}

$latestthreads .= '</ul>';

$vbulletin->db->free_result($threads);
unset($thread);

And then just use $latestthreads in the template to get it.

Any ideas why it doesn't work in 3.8?

kh99
12-10-2009, 12:58 AM
I'm not familiar with 3.7, but I tried it in 3.8 and it works for me. Where are you putting the variable?

Razasharp
12-10-2009, 12:59 AM
In the header template :-/

kh99
12-10-2009, 01:01 AM
Yeah, that's why - header is parsed in global.php before that hook is called.

Razasharp
12-10-2009, 01:03 AM
Any ideas how I can get it to work? I don't mind editing the files if I have to..

kh99
12-10-2009, 01:06 AM
You could try using a hook that comes before that - global_start maybe.

ETA: but if you do that you probably want to check THIS_SCRIPT and only do it if it's 'index' (as it is set in forum.php).

Razasharp
12-10-2009, 01:09 AM
Thanks!!!!!!!!!! that works! :D