MyBB Community Forums

Full Version: Search with only selected prefix ids
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone,

[Image: th_538402742_ddfgdfg_122_1054lo.JPG]

Im trying to change searching prefix option by using only selected prefixes not all of them. As i understood this is indicated at search.php line 1527:
$prefixselect = build_prefix_select('all', 'any', 1);

Please help me to change that 'all' to list of prefix ids, if there are totally 10 prefixes ids, how to filter only by 4 selected prefixes ? (So if i have 10 prefixes, how to show only 4 prefixes in the search option?)
Here is the execution code:

<select name="threadprefix" multiple="multiple" size="5">
<option value="any" selected="selected">Find threads with any prefix</option>
<option value="0">No prefix</option>
<option value="7">Red</option>
<option value="8">Blue</option>
<option value="10">Green</option>
</select>

Thanks for attention
Thanks to RateU we know the solution is in the $prefixselect (function.php) modification.

Ive made all variants that i could but or it has no needed effect or the search.php stoped working at all Toungue.

}
$prefixselect = "";
if($db->num_rows($query) > 0)
{
$multipleselect = "";
if($multiple != 0)
{
$multipleselect = " multiple=\"multiple\" size=\"5\"";
}
$prefixselect = "<select name=\"threadprefix\"{$multipleselect}>\n";
if($multiple == 1)
{
$any_selected = "";
if($selected_pid == 'any')
{
$any_selected = " selected=\"selected\"";
}
$prefixselect .= "<option value=\"any\"".$any_selected.">".$lang->any_prefix."</option>\n";
}
$default_selected = "";
if((intval($selected_pid) == 0) && $selected_pid != 'any')
{
$default_selected = " selected=\"selected\"";
}
$prefixselect .= "<option value=\"0\"".$default_selected.">".$lang->no_prefix."</option>\n";
while($prefix = $db->fetch_array($query))
{
$selected = "";
if($prefix['pid'] == $selected_pid)
{
$selected = " selected=\"selected\"";
}
$prefixselect .= "<option value=\"".$prefix['pid']."\"".$selected.">".htmlspecialchars_uni($prefix['prefix'])."</option>\n";
}
$prefixselect .= "</select>\n&nbsp;";
}
return $prefixselect;

The solution was found thanks to RateU and ZiNgA BuRgA.

Search Templates > search

Find:
{$prefixselect}
Replace:
<select name="threadprefix" multiple="multiple" size="5">
<option value="any" selected="selected">Find threads with any prefix</option>
<option value="0">No prefix</option>
<option value="7">Red</option>
<option value="8">Blue</option>
<option value="10">Green</option>
</select>