MyBB Hacks

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:

Code:
$prefixselect = build_prefix_select('all', 'any', 1);


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

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

I think the "easiest" way is, put the HTML form directly in your search template.
Otherwise, I think you need to edit the build_prefix_select function in functions.php file manually.
Thanks for taking time looking at my question.

In the search template its referred to $prefixselect (functions.php - as you said)

Quote:}
$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;

Ive made all variants that i could but or it has no needed effect or the search.php stoped working at all Tongue.
Im sorry but i just cant read the code properly, please help me.
You need to edit the query (above the codes), maybe using a variable, and use condition so the modification only works in search.php.

For search results, I think you need to edit the query in search.php too.
Thanks for answering.
I im just trying to modify the list of selectable prefixes, i don't want to change the search code, only not me Biggrin.
So will go the experiment way, what if i change that, and so on Biggrin.

Thanks for your explanations, they were useful. Wink
As RateU said earlier, your easiest option is just to edit your search template - replace

Code:
{$prefixselect}

with

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>


Note that this will cause it to ignore all group permissions, or if you delete a prefix later, you'll also have to remember to remove it from the above code.

Its works Yipi

[Image: th_443901468_madprof_122_205lo.jpg]

Thank you very much RateU and ZiNgA BuRgA. Wink2
Reference URL's