The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
functions_threadmanage.php builds the $jumpforumbits variable, for use, obviously, in the "Forum Jump" select/option list.
I want a similar variable that includes only the "Category" forums, those with parentid = -1 in the database. I could obviously "hack" the PHP file to contain my own function, and then hack the other files to call this function when/where I needed. I'm wondering, though, if I wanted to use the PlugIn system, where I would place this code? I want the new thread template to be able to use this variable. Another way of asking: which HOOK do I use to add a function to the functions_threadmanage.php file, and which hook do I use to call that function, returning a variable that is accessible in the New Thread template? EDIT: Ok... no answers. Maybe the question isn't clear. Another try: I add the following plugin code to the "newthread_post_start" hook. Code:
global $mycatbits;
$myCats = $vbulletin->$db->query_read("SELECT forumid, title from vb_forum where parentid = -1");
$mycatbits = '';
while ($row = $vbulletin->$db->fetch_array($myCats))
{
$optionvalue = $row[forumid];
$optiontitle = $row[title];
eval('$mycatbits .= "' . fetch_template('option') . '";');
}
Then, in the "newthread" template, I expect to be able to put: Code:
<select>$mycatbits</select> EDIT: Ok... here's what finally "worked", though I still have a question. 1st, it's important to find the correct hook. I was using "newthread_post_start", which isn't the right hook. In hook location "newthread_start": Code:
global $mycatbits;
$mycatbits = '';
if ($vbulletin->forumcache[$forumid]['parentid'] == 42);
{
$show['catlist'] = true;
$myCats = $db->query_read("SELECT forumid, title from vb_forum where parentid = -1 and forumid != 42");
while ($row = $db->fetch_array($myCats))
{
$optionvalue = $row[forumid];
$optiontitle = $row[title];
eval('$mycatbits .= "' . fetch_template('option') . '";');
}
}
I added a phrase called "cat_feature" via the Phrase Manager. Then, in the "newthread" template, I added the following code, after the "subject field" comment: Code:
<if condition="$show['catlist']"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="smallfont" colspan="3">$vbphrase[cat_feature]:</td> </tr> <tr> <td> <select name="cat_feature"> $mycatbits </select><br /><br /> </td> </tr> </table> </if> My question: Code:
$myCats = $db->query_read("SELECT forumid, title from vb_forum where parentid = -1 and forumid != 42");
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|