MyBB Community Forums
Set the default search to title only - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: Set the default search to title only (/thread-235063.html)



Set the default search to title only - Firnus - 2022-03-02

Hi,
I like to set the default search to title only.

1. Search in title by default with quick search
2. Check automatically the title only in adcandec search

For 2 : i can do it via theme
But for 1 i didn't find how to do this ?

I see the event search_do_search_start , but no way to set default search since it get by
"postthread" => $mybb->get_input('postthread', MyBB::INPUT_INT),
Any idea ?

Sorry …

header_quicksearch :
<input type="hidden" name="postthread" value="2" />



RE: Set the default search to title only - xLoy - 2022-03-06

Deleted.


RE: Set the default search to title only - HLFadmin - 2022-03-07

Dev not required for this. He answered his own question.

For a more detailed explanation:

postthread is a radio toggle in the advanced search form controlled by the search template. Value=1 for searching the post, Value=2 for searching the thread title. The default value is controlled by checked="checked".

<span class="smalltext"><input type="radio" class="radio" name="postthread" value="1" checked="checked" />{$lang->search_entire_post}<br /><input type="radio" class="radio" name="postthread" value="2" />{$lang->search_titles_only}</span></td>

The header_quicksearch template sets the default value of postthread to 1 for searching posts. He changed it to 2 for searching titles.