View Full Version : Add drop down to certain boards and not others.
SpawnedX
07-22-2012, 02:15 AM
I would like to add a drop down box to some of my boards. In this drop down box it would be a list of my prefixes for that board and when they click on one of the prefixes in the drop down it will sort that board by the prefixes.
I know I will have to have the forumdisplay template check the board ID and if is one of the board IDs I want the box on then display it. Could someone show me what the if statement would look like for checking the board ID? I can figure out the drop down menu part for myself.
Also on a related note, is there a way to add a tabid onto the address a board link opens?
Simon Lloyd
07-22-2012, 02:20 AM
The search function already allows for searching and filtering by prefix. When you say "Sort the board" do you mean every forum or just the forum the member is viewing?
SpawnedX
07-22-2012, 02:28 AM
Just the forum the member is looking at. This isn't filtering by prefix in the same manner. The forum covers a couple different models of cars and I have a prefix for each model. Currently I am using Lynne's plug to click on the prefixes and that will eliminate all threads without that prefix on the current board.
The problem is, the person has to search for a post with that prefix in the board they want to quick sort without fully searching. So if there is a drop down menu on the board at the top, they can just set it to whatever model they need to search for.
Simon Lloyd
07-22-2012, 03:52 AM
Ok, go to Plugins & Products in your admincp, Add new plugin, give it a name and description, use hook loaction "forumdisplay_query" add this code$frm = array(1,2,3,4,5,6);
if (in_array($forumid, $frm)) {
$fld = 'prefixid';
$query= "SELECT DISTINCT $fld FROM ".TABLE_PREFIX."thread";
$result = mysql_query($query) or die(mysql_error());
$dropdown = "<form>\r\n<select name='myfld'>";
while($row = mysql_fetch_assoc($result)) {
$dropdown .= "\r\n<option value='$row[$fld]'>{$row[$fld]}</option>";}$dropdown .= "\r\n</select>\r\n<input type='hidden' name='f' value='$forumid'><input type='submit' value='Filter by Make (only for this page)' />\r\n</form>";
}
$vbulletin->input->clean_gpc('r', 'myfld', TYPE_STR);
$myfld = $vbulletin->GPC['myfld'];
if (!empty($myfld))
{
$hook_query_where .= " AND thread.{$fld} = '" . $db->escape_string($myfld) . "' ";
}Replace the forumids (i,2,3,...etc) for the forums that you want this to work on, then in your forumdisplay template put this under $navbar$dropdown<br />
SpawnedX
07-22-2012, 04:19 AM
Unfortunately it only printed $dropdown on the page.
Is there no way to just add to a template a basic if $forumid = 11 then do this style thing? I know it's messy, but this vB4 code looks nothing like what I am familiar with in vB3.
--------------- Added 1342934977 at 1342934977 ---------------
Even this doesn't work:
<vb:if condition="$forum[forumid] == 11">Show this if forum ID is 11.</vb:if>
I think I am just going to go back to vB 3.8.
Simon Lloyd
07-22-2012, 04:39 AM
I dont have a copy of vb4 to work with at the moment, if you can wait a couple of days until i finish work i'll be able to check that out, or maybe someone will jump in before then, maybe you can try {vb:raw $dropdown}
Did you have the plugin enabled???
SpawnedX
07-22-2012, 05:12 AM
Yeah I had it enabled. I have found a way to do it with a conditional if statement. That's good enough for me. Thanks though.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.